From b60abb206b5f62689a71ea05c731ec1fd5e0c1af Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Fri, 11 Apr 2014 09:36:43 +0200 Subject: [PATCH] fix cs --- .../Controller/Admin/CacheController.php | 3 +- .../Controller/Front/BaseFrontController.php | 10 +- .../Thelia/Core/Template/ParserInterface.php | 4 +- .../Core/Template/Smarty/SmartyParser.php | 2 +- core/lib/Thelia/Form/Cache/CacheFlushForm.php | 3 +- core/lib/Thelia/Log/Tlog.php | 3 +- core/lib/Thelia/Model/Order.php | 2 +- .../Thelia/Module/AbstractPaymentModule.php | 262 +++++++++--------- 8 files changed, 143 insertions(+), 146 deletions(-) diff --git a/core/lib/Thelia/Controller/Admin/CacheController.php b/core/lib/Thelia/Controller/Admin/CacheController.php index 4f183cfd4..d7790f3c8 100644 --- a/core/lib/Thelia/Controller/Admin/CacheController.php +++ b/core/lib/Thelia/Controller/Admin/CacheController.php @@ -30,7 +30,6 @@ use Thelia\Core\Security\Resource\AdminResources; use Thelia\Form\Cache\CacheFlushForm; use Thelia\Form\Exception\FormValidationException; - /** * Class CacheController * @package Thelia\Controller\Admin @@ -70,4 +69,4 @@ class CacheController extends BaseAdminController } } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Front/BaseFrontController.php b/core/lib/Thelia/Controller/Front/BaseFrontController.php index 132d02215..f065274f2 100644 --- a/core/lib/Thelia/Controller/Front/BaseFrontController.php +++ b/core/lib/Thelia/Controller/Front/BaseFrontController.php @@ -49,8 +49,8 @@ class BaseFrontController extends BaseController * Redirect to à route ID related URL * * @param string $routeId the route ID, as found in Config/Resources/routing/admin.xml - * @param array $urlParameters the URL parametrs, as a var/value pair array - * @param bool $referenceType + * @param array $urlParameters the URL parametrs, as a var/value pair array + * @param bool $referenceType */ public function redirectToRoute($routeId, $urlParameters = array(), $referenceType = Router::ABSOLUTE_PATH) { @@ -104,9 +104,9 @@ class BaseFrontController extends BaseController /** * Render the given template, and returns the result as an Http Response. * - * @param string $templateName the complete template name, with extension - * @param array $args the template arguments - * @param int $status http code status + * @param string $templateName the complete template name, with extension + * @param array $args the template arguments + * @param int $status http code status * @return \Thelia\Core\HttpFoundation\Response */ protected function render($templateName, $args = array(), $status = 200) diff --git a/core/lib/Thelia/Core/Template/ParserInterface.php b/core/lib/Thelia/Core/Template/ParserInterface.php index 3e81f49f4..2ee2f00f5 100644 --- a/core/lib/Thelia/Core/Template/ParserInterface.php +++ b/core/lib/Thelia/Core/Template/ParserInterface.php @@ -60,9 +60,9 @@ interface ParserInterface /** * Return the registeted template directories for a givent template type * - * @param unknown $templateType + * @param unknown $templateType * @throws \InvalidArgumentException if the templateType is not defined - * @return array: an array of defined templates directories for the given template type + * @return array: an array of defined templates directories for the given template type */ public function getTemplateDirectories($templateType); diff --git a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php index 0e335c77e..9f70af987 100644 --- a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php +++ b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php @@ -116,7 +116,7 @@ class SmartyParser extends Smarty implements ParserInterface /** * Return the registeted template directories for a givent template type * - * @param int $templateType + * @param int $templateType * @throws InvalidArgumentException * @return mixed: */ diff --git a/core/lib/Thelia/Form/Cache/CacheFlushForm.php b/core/lib/Thelia/Form/Cache/CacheFlushForm.php index 8410bd7c7..f921df455 100644 --- a/core/lib/Thelia/Form/Cache/CacheFlushForm.php +++ b/core/lib/Thelia/Form/Cache/CacheFlushForm.php @@ -25,7 +25,6 @@ namespace Thelia\Form\Cache; use Thelia\Form\BaseForm; - /** * Class CacheFlushForm * @package Thelia\Form\Cache @@ -66,4 +65,4 @@ class CacheFlushForm extends BaseForm { return "cache_flush"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Log/Tlog.php b/core/lib/Thelia/Log/Tlog.php index f7863eb8d..41ebbad0c 100644 --- a/core/lib/Thelia/Log/Tlog.php +++ b/core/lib/Thelia/Log/Tlog.php @@ -129,7 +129,8 @@ class Tlog Implements LoggerInterface * * @return Tlog a new Tlog instance. */ - public static function getNewInstance() { + public static function getNewInstance() + { $instance = new Tlog(); $instance->init(); diff --git a/core/lib/Thelia/Model/Order.php b/core/lib/Thelia/Model/Order.php index aa69cf6f8..d0fd7f43a 100644 --- a/core/lib/Thelia/Model/Order.php +++ b/core/lib/Thelia/Model/Order.php @@ -40,7 +40,7 @@ class Order extends BaseOrder public function postSave(ConnectionInterface $con = null) { - if($this->isPaid() && null === $this->getInvoiceDate()) { + if ($this->isPaid() && null === $this->getInvoiceDate()) { $this ->setInvoiceDate(time()) ->save($con); diff --git a/core/lib/Thelia/Module/AbstractPaymentModule.php b/core/lib/Thelia/Module/AbstractPaymentModule.php index f80dd17f9..7936dee16 100644 --- a/core/lib/Thelia/Module/AbstractPaymentModule.php +++ b/core/lib/Thelia/Module/AbstractPaymentModule.php @@ -1,132 +1,130 @@ -. */ -/* */ -/*************************************************************************************/ - -namespace Thelia\Module; - -use Symfony\Component\Routing\Router; -use Thelia\Core\HttpFoundation\Response; -use Thelia\Core\Template\ParserInterface; -use Thelia\Core\Template\TemplateHelper; -use Thelia\Exception\TheliaProcessException; -use Thelia\Model\Order; -use Thelia\Tools\URL; - -abstract class AbstractPaymentModule extends BaseModule implements PaymentModuleInterface -{ - /** - * This method is called when the payement gateway needs to be invoked. - * - * If this method return a Response instance, this response is sent to the browser. Return null if you don't want to - * send a response and process the payment yourself. - * - * In many cases, it's necessary to send a form to the payment gateway. On your response you can return this form already - * completed, ready to be sent, instead of redirecting. The generateGatewayFormResponse() may help you in this case :) - * - * @param Order $order processed order - * @return null|Response - */ - abstract public function pay(Order $order); - - /** - * This method is called by the Payment loop, to check if the current module has to be displayed to the customer - * - * If you return true, the payment method will de displayed to the customed - * If you return false, the payment method will not be displayed - * - * @return boolean - */ - abstract public function isValidPayment(); - - - /** - * Render the payment gateway template. The module should provide the gateway URL and the form fields names and values. - * - * @param Order $order the order - * @param string $gateway_url the payment gateway URL - * @param array $form_data an associative array of form data, that will be rendered as hiddent fields - * - * @return Response the HTTP response. - */ - public function generateGatewayFormResponse($order, $gateway_url, $form_data) - { - /** @var ParserInterface $parser */ - $parser = $this->container->get("thelia.parser"); - - $parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveFrontTemplate()); - - $renderedTemplate = $parser->render( - "order-payment-gateway.html", - array( - "order_id" => $order->getId(), - "cart_count" => $this->getRequest()->getSession()->getCart()->getCartItems()->count(), - "gateway_url" => $gateway_url, - "payment_form_data" => $form_data - ) - ); - - return Response::create($renderedTemplate); - } - - /** - * Return the order payment success page URL - * - * @param int $order_id the order ID - * @return string the order payment success page URL - */ - public function getPayementSuccessPageUrl($order_id) - { - $frontOfficeRouter = $this->container->get('router.front'); - - return URL::getInstance()->absoluteUrl( - $frontOfficeRouter->generate( - "order.placed", - array("order_id" => $order_id), - Router::ABSOLUTE_URL - ) - ); - } - - /** - * Redirect the customer to the failure payment page. if $message is null, a generic message is displayed. - * - * @param int $order_id the order ID - * @param string|null $message an error message. - * - * @return string the order payment failure page URL - */ - public function getPayementFailurePageUrl($order_id, $message) - { - $frontOfficeRouter = $this->container->get('router.front'); - - return URL::getInstance()->absoluteUrl( - $frontOfficeRouter->generate( - "order.failed", - array( - "order_id" => $order_id, - "message" => $message - ), - Router::ABSOLUTE_URL - ) - ); - } -} +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Module; + +use Symfony\Component\Routing\Router; +use Thelia\Core\HttpFoundation\Response; +use Thelia\Core\Template\ParserInterface; +use Thelia\Core\Template\TemplateHelper; +use Thelia\Model\Order; +use Thelia\Tools\URL; + +abstract class AbstractPaymentModule extends BaseModule implements PaymentModuleInterface +{ + /** + * This method is called when the payement gateway needs to be invoked. + * + * If this method return a Response instance, this response is sent to the browser. Return null if you don't want to + * send a response and process the payment yourself. + * + * In many cases, it's necessary to send a form to the payment gateway. On your response you can return this form already + * completed, ready to be sent, instead of redirecting. The generateGatewayFormResponse() may help you in this case :) + * + * @param Order $order processed order + * @return null|Response + */ + abstract public function pay(Order $order); + + /** + * This method is called by the Payment loop, to check if the current module has to be displayed to the customer + * + * If you return true, the payment method will de displayed to the customed + * If you return false, the payment method will not be displayed + * + * @return boolean + */ + abstract public function isValidPayment(); + + /** + * Render the payment gateway template. The module should provide the gateway URL and the form fields names and values. + * + * @param Order $order the order + * @param string $gateway_url the payment gateway URL + * @param array $form_data an associative array of form data, that will be rendered as hiddent fields + * + * @return Response the HTTP response. + */ + public function generateGatewayFormResponse($order, $gateway_url, $form_data) + { + /** @var ParserInterface $parser */ + $parser = $this->container->get("thelia.parser"); + + $parser->setTemplateDefinition(TemplateHelper::getInstance()->getActiveFrontTemplate()); + + $renderedTemplate = $parser->render( + "order-payment-gateway.html", + array( + "order_id" => $order->getId(), + "cart_count" => $this->getRequest()->getSession()->getCart()->getCartItems()->count(), + "gateway_url" => $gateway_url, + "payment_form_data" => $form_data + ) + ); + + return Response::create($renderedTemplate); + } + + /** + * Return the order payment success page URL + * + * @param int $order_id the order ID + * @return string the order payment success page URL + */ + public function getPayementSuccessPageUrl($order_id) + { + $frontOfficeRouter = $this->container->get('router.front'); + + return URL::getInstance()->absoluteUrl( + $frontOfficeRouter->generate( + "order.placed", + array("order_id" => $order_id), + Router::ABSOLUTE_URL + ) + ); + } + + /** + * Redirect the customer to the failure payment page. if $message is null, a generic message is displayed. + * + * @param int $order_id the order ID + * @param string|null $message an error message. + * + * @return string the order payment failure page URL + */ + public function getPayementFailurePageUrl($order_id, $message) + { + $frontOfficeRouter = $this->container->get('router.front'); + + return URL::getInstance()->absoluteUrl( + $frontOfficeRouter->generate( + "order.failed", + array( + "order_id" => $order_id, + "message" => $message + ), + Router::ABSOLUTE_URL + ) + ); + } +}