From c65ec67bdf830b6f78939c7d0bc747373245e767 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 30 Sep 2013 10:35:34 +0200 Subject: [PATCH] fix cs --- core/lib/Thelia/Action/Address.php | 4 +- core/lib/Thelia/Action/Attribute.php | 8 +- core/lib/Thelia/Action/AttributeAv.php | 4 +- core/lib/Thelia/Action/BaseAction.php | 2 - core/lib/Thelia/Action/BaseCachedFile.php | 13 ++- core/lib/Thelia/Action/Category.php | 10 +-- core/lib/Thelia/Action/Content.php | 10 +-- core/lib/Thelia/Action/Document.php | 11 +-- core/lib/Thelia/Action/Feature.php | 8 +- core/lib/Thelia/Action/FeatureAv.php | 4 +- core/lib/Thelia/Action/Folder.php | 13 ++- core/lib/Thelia/Action/HttpException.php | 2 +- core/lib/Thelia/Action/Image.php | 18 ++-- core/lib/Thelia/Action/Order.php | 11 +-- core/lib/Thelia/Action/Product.php | 58 ++++++------- core/lib/Thelia/Action/Template.php | 25 ++---- core/lib/Thelia/Command/CacheClear.php | 5 +- .../Thelia/Command/ModuleActivateCommand.php | 7 +- .../Thelia/Command/ReloadDatabaseCommand.php | 2 +- .../Admin/AbstractCrudController.php | 81 ++++++++---------- .../Controller/Admin/AdminController.php | 6 +- .../Admin/AttributeAvController.php | 2 +- .../Controller/Admin/AttributeController.php | 9 +- .../Controller/Admin/BaseAdminController.php | 16 ++-- .../Controller/Admin/CategoryController.php | 77 +++++++++-------- .../Controller/Admin/ConfigController.php | 53 +++++++----- .../Controller/Admin/ContentController.php | 13 ++- .../Controller/Admin/CountryController.php | 4 +- .../Controller/Admin/CouponController.php | 4 - .../Controller/Admin/CurrencyController.php | 54 +++++++----- .../Controller/Admin/CustomerController.php | 17 ++-- .../Controller/Admin/FeatureAvController.php | 2 +- .../Controller/Admin/FeatureController.php | 9 +- .../Controller/Admin/FileController.php | 9 -- .../Controller/Admin/FolderController.php | 31 +++---- .../Controller/Admin/ModuleController.php | 11 ++- .../Controller/Admin/OrderController.php | 30 ++++--- .../Controller/Admin/ProductController.php | 82 +++++++++---------- .../Controller/Admin/SessionController.php | 5 +- .../Admin/ShippingConfigurationController.php | 5 +- .../Admin/ShippingZoneController.php | 11 ++- .../Controller/Admin/TemplateController.php | 38 ++++----- core/lib/Thelia/Controller/BaseController.php | 3 +- .../Controller/Front/AddressController.php | 8 +- .../Controller/Front/BaseFrontController.php | 8 +- .../Controller/Front/CustomerController.php | 2 +- .../Controller/Front/OrderController.php | 11 ++- .../Address/AddressCreateOrUpdateEvent.php | 2 - .../Core/Event/Content/ContentCreateEvent.php | 8 +- .../Core/Event/Content/ContentDeleteEvent.php | 6 +- .../Core/Event/Content/ContentEvent.php | 5 +- .../Content/ContentToggleVisibilityEvent.php | 3 +- .../Core/Event/Content/ContentUpdateEvent.php | 8 +- .../Customer/CustomerCreateOrUpdateEvent.php | 10 +-- .../Document/DocumentCreateOrUpdateEvent.php | 3 +- .../Event/Document/DocumentDeleteEvent.php | 1 - .../FeatureProduct/FeatureProductEvent.php | 2 +- .../Core/Event/Folder/FolderCreateEvent.php | 7 +- .../Core/Event/Folder/FolderDeleteEvent.php | 10 +-- .../Thelia/Core/Event/Folder/FolderEvent.php | 9 +- .../Folder/FolderToggleVisibilityEvent.php | 7 +- .../Core/Event/Folder/FolderUpdateEvent.php | 8 +- .../Core/Event/GenerateRewrittenUrlEvent.php | 7 +- .../Event/Image/ImageCreateOrUpdateEvent.php | 5 +- .../Core/Event/Image/ImageDeleteEvent.php | 3 +- .../Thelia/Core/Event/LostPasswordEvent.php | 9 +- .../Core/Event/MailTransporterEvent.php | 6 +- .../Core/Event/Product/ProductCreateEvent.php | 9 ++ .../Event/Product/ProductSetTemplateEvent.php | 1 - .../Event/Template/TemplateUpdateEvent.php | 2 + core/lib/Thelia/Core/Event/TheliaEvents.php | 2 - .../Core/EventListener/ViewListener.php | 2 +- .../Core/HttpFoundation/Session/Session.php | 13 ++- .../Exception/NotFountHttpException.php | 8 +- .../Authentication/TokenAuthenticator.php | 2 - .../Core/Security/Token/TokenProvider.php | 7 +- .../Core/Security/User/UserInterface.php | 2 +- .../UserProvider/AdminTokenUserProvider.php | 5 +- .../CustomerTokenUserProvider.php | 7 +- .../UserProvider/CustomerUserProvider.php | 2 +- .../UserProvider/TokenUserProvider.php | 3 +- .../Thelia/Core/Template/Loop/Accessory.php | 2 +- .../lib/Thelia/Core/Template/Loop/Address.php | 2 +- .../Core/Template/Loop/Argument/Argument.php | 4 +- .../Core/Template/Loop/AssociatedContent.php | 2 +- .../Thelia/Core/Template/Loop/Attribute.php | 10 +-- core/lib/Thelia/Core/Template/Loop/Coupon.php | 1 - .../Thelia/Core/Template/Loop/Delivery.php | 4 +- .../Thelia/Core/Template/Loop/Document.php | 3 +- .../lib/Thelia/Core/Template/Loop/Feature.php | 8 +- core/lib/Thelia/Core/Template/Loop/Image.php | 3 +- core/lib/Thelia/Core/Template/Loop/Module.php | 2 +- .../Core/Template/Loop/OrderAddress.php | 3 - .../Core/Template/Loop/OrderProduct.php | 7 -- .../Loop/OrderProductAttributeCombination.php | 2 - .../lib/Thelia/Core/Template/Loop/Payment.php | 1 - .../lib/Thelia/Core/Template/Loop/Product.php | 6 +- .../Template/Loop/ProductSaleElements.php | 4 +- .../lib/Thelia/Core/Template/Loop/TaxRule.php | 2 +- .../Thelia/Core/Template/Loop/Template.php | 7 +- .../Smarty/Plugins/DataAccessFunctions.php | 13 ++- .../Template/Smarty/Plugins/FlashMessage.php | 4 - .../Core/Template/Smarty/Plugins/Form.php | 3 +- .../Core/Template/Smarty/Plugins/Security.php | 12 +-- .../Template/Smarty/Plugins/TheliaLoop.php | 1 + .../Core/Template/Smarty/Plugins/Type.php | 10 +-- .../Template/Smarty/Plugins/UrlGenerator.php | 7 +- core/lib/Thelia/Core/Thelia.php | 1 - core/lib/Thelia/Core/TheliaHttpKernel.php | 2 +- core/lib/Thelia/Exception/OrderException.php | 2 +- core/lib/Thelia/Form/AddressCreateForm.php | 2 +- core/lib/Thelia/Form/AddressUpdateForm.php | 2 +- core/lib/Thelia/Form/AdminLogin.php | 2 +- .../Thelia/Form/AttributeAvCreationForm.php | 4 +- .../lib/Thelia/Form/AttributeCreationForm.php | 2 - .../Thelia/Form/AttributeModificationForm.php | 4 - .../Form/CategoryDocumentModification.php | 3 - .../Thelia/Form/CategoryImageModification.php | 2 - .../Form/ContentDocumentModification.php | 3 - .../Thelia/Form/ContentImageModification.php | 2 - .../Thelia/Form/ContentModificationForm.php | 5 +- core/lib/Thelia/Form/CountryCreationForm.php | 10 +-- .../Thelia/Form/CountryModificationForm.php | 12 +-- core/lib/Thelia/Form/CouponCreationForm.php | 1 - core/lib/Thelia/Form/CustomerCreation.php | 2 +- .../Thelia/Form/CustomerLostPasswordForm.php | 6 +- .../lib/Thelia/Form/FeatureAvCreationForm.php | 4 +- core/lib/Thelia/Form/FeatureCreationForm.php | 2 - .../Thelia/Form/FeatureModificationForm.php | 4 - .../Form/FolderDocumentModification.php | 3 - .../Thelia/Form/FolderImageModification.php | 2 - .../Form/Image/DocumentModification.php | 1 - .../Thelia/Form/Image/ImageModification.php | 1 - core/lib/Thelia/Form/OrderDelivery.php | 8 +- core/lib/Thelia/Form/OrderPayment.php | 8 +- core/lib/Thelia/Form/OrderUpdateAddress.php | 8 +- .../Form/ProductDetailsModificationForm.php | 2 +- .../Form/ProductDocumentModification.php | 3 - .../Thelia/Form/ProductImageModification.php | 2 - .../Thelia/Form/ProductModificationForm.php | 2 +- .../Thelia/Form/ProfileModificationForm.php | 1 - core/lib/Thelia/Form/TemplateCreationForm.php | 2 - .../Thelia/Form/TemplateModificationForm.php | 4 - core/lib/Thelia/Module/BaseModule.php | 24 +++--- .../Thelia/Module/PaymentModuleInterface.php | 2 - core/lib/Thelia/Tests/Action/CustomerTest.php | 3 +- core/lib/Thelia/Tests/Action/OrderTest.php | 18 ++-- .../Command/ModuleActivateCommandTest.php | 5 +- .../Condition/ConditionEvaluatorTest.php | 1 - .../Tests/Condition/ConditionFactoryTest.php | 6 -- .../MatchForEveryoneManagerTest.php | 2 - .../Thelia/Tests/Condition/OperatorsTest.php | 4 +- .../Core/Template/Element/BaseLoopTestor.php | 1 - .../Tests/Core/Template/Loop/DocumentTest.php | 1 - .../Tests/Core/Template/Loop/ImageTest.php | 1 - .../Thelia/Tests/Module/BaseModuleTestor.php | 2 - .../Tests/Rewriting/BaseRewritingObject.php | 5 +- .../Tests/Rewriting/CategoryRewritingTest.php | 5 +- .../Tests/Rewriting/ContentRewritingTest.php | 5 +- .../Tests/Rewriting/FolderRewritingTest.php | 5 +- .../Tests/Rewriting/ProductRewriteTest.php | 6 +- .../Thelia/Tests/Tools/FileManagerTest.php | 17 +--- core/lib/Thelia/Tools/FileManager.php | 8 +- core/lib/Thelia/Tools/I18n.php | 10 +-- core/lib/Thelia/Tools/Image.php | 7 +- core/lib/Thelia/Tools/URL.php | 3 +- .../lib/Thelia/Type/FloatToFloatArrayType.php | 5 +- core/lib/Thelia/Type/ModelType.php | 2 +- 168 files changed, 577 insertions(+), 818 deletions(-) diff --git a/core/lib/Thelia/Action/Address.php b/core/lib/Thelia/Action/Address.php index 92d225df4..b25c9c4ba 100644 --- a/core/lib/Thelia/Action/Address.php +++ b/core/lib/Thelia/Action/Address.php @@ -86,14 +86,14 @@ class Address extends BaseAction implements EventSubscriberInterface ->save() ; - if($event->getIsDefault()) { + if ($event->getIsDefault()) { $addressModel->makeItDefault(); } $event->setAddress($addressModel); $con->commit(); - } catch(PropelException $e) { + } catch (PropelException $e) { $con->rollback(); throw $e; } diff --git a/core/lib/Thelia/Action/Attribute.php b/core/lib/Thelia/Action/Attribute.php index 3cfab85f7..7db04518a 100644 --- a/core/lib/Thelia/Action/Attribute.php +++ b/core/lib/Thelia/Action/Attribute.php @@ -33,11 +33,7 @@ use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\Attribute\AttributeUpdateEvent; use Thelia\Core\Event\Attribute\AttributeCreateEvent; use Thelia\Core\Event\Attribute\AttributeDeleteEvent; -use Thelia\Model\ConfigQuery; -use Thelia\Model\AttributeAv; -use Thelia\Model\AttributeAvQuery; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Core\Event\Category\CategoryEvent; use Thelia\Core\Event\Attribute\AttributeEvent; use Thelia\Model\AttributeTemplate; use Thelia\Model\AttributeTemplateQuery; @@ -130,7 +126,7 @@ class Attribute extends BaseAction implements EventSubscriberInterface { $templates = TemplateQuery::create()->find(); - foreach($templates as $template) { + foreach ($templates as $template) { $attribute_template = new AttributeTemplate(); @@ -171,4 +167,4 @@ class Attribute extends BaseAction implements EventSubscriberInterface ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/AttributeAv.php b/core/lib/Thelia/Action/AttributeAv.php index 7ccf39dcc..83d85b398 100644 --- a/core/lib/Thelia/Action/AttributeAv.php +++ b/core/lib/Thelia/Action/AttributeAv.php @@ -33,7 +33,6 @@ use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\Attribute\AttributeAvUpdateEvent; use Thelia\Core\Event\Attribute\AttributeAvCreateEvent; use Thelia\Core\Event\Attribute\AttributeAvDeleteEvent; -use Thelia\Model\ConfigQuery; use Thelia\Core\Event\UpdatePositionEvent; class AttributeAv extends BaseAction implements EventSubscriberInterface @@ -115,7 +114,6 @@ class AttributeAv extends BaseAction implements EventSubscriberInterface return $this->genericUpdatePosition(AttributeAvQuery::create(), $event); } - /** * {@inheritDoc} */ @@ -128,4 +126,4 @@ class AttributeAv extends BaseAction implements EventSubscriberInterface TheliaEvents::ATTRIBUTE_AV_UPDATE_POSITION => array("updatePosition", 128), ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/BaseAction.php b/core/lib/Thelia/Action/BaseAction.php index d371919eb..33deddf2b 100755 --- a/core/lib/Thelia/Action/BaseAction.php +++ b/core/lib/Thelia/Action/BaseAction.php @@ -24,7 +24,6 @@ namespace Thelia\Action; use Symfony\Component\DependencyInjection\ContainerInterface; use Thelia\Model\AdminLog; -use Propel\Runtime\ActiveQuery\PropelQuery; use Propel\Runtime\ActiveQuery\ModelCriteria; use Thelia\Core\Event\UpdatePositionEvent; @@ -50,7 +49,6 @@ class BaseAction return $this->container->get('event_dispatcher'); } - /** * Changes object position, selecting absolute ou relative change. * diff --git a/core/lib/Thelia/Action/BaseCachedFile.php b/core/lib/Thelia/Action/BaseCachedFile.php index b66496e07..caa7c8ada 100644 --- a/core/lib/Thelia/Action/BaseCachedFile.php +++ b/core/lib/Thelia/Action/BaseCachedFile.php @@ -23,10 +23,7 @@ namespace Thelia\Action; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - use Thelia\Core\Event\CachedFileEvent; -use Thelia\Model\ConfigQuery; use Thelia\Tools\URL; /** @@ -50,7 +47,7 @@ abstract class BaseCachedFile extends BaseAction /** * @return string root of the file cache directory in web space */ - protected abstract function getCacheDirFromWebRoot(); + abstract protected function getCacheDirFromWebRoot(); /** * Clear the file cache. Is a subdirectory is specified, only this directory is cleared. @@ -104,9 +101,9 @@ abstract class BaseCachedFile extends BaseAction /** * Return the full path of the cached file * - * @param string $subdir the subdirectory related to cache base - * @param string $filename the filename - * @param string $hashed_options a hash of transformation options, or null if no transformations have been applied + * @param string $subdir the subdirectory related to cache base + * @param string $filename the filename + * @param string $hashed_options a hash of transformation options, or null if no transformations have been applied * @param boolean $forceOriginalDocument if true, the original file path in the cache dir is returned. * @return string the cache directory path relative to Web Root */ @@ -175,4 +172,4 @@ abstract class BaseCachedFile extends BaseAction return $path; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/Category.php b/core/lib/Thelia/Action/Category.php index c11064881..815ea162a 100755 --- a/core/lib/Thelia/Action/Category.php +++ b/core/lib/Thelia/Action/Category.php @@ -33,7 +33,6 @@ use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\Category\CategoryUpdateEvent; use Thelia\Core\Event\Category\CategoryCreateEvent; use Thelia\Core\Event\Category\CategoryDeleteEvent; -use Thelia\Model\ConfigQuery; use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Core\Event\Category\CategoryToggleVisibilityEvent; use Thelia\Core\Event\Category\CategoryAddContentEvent; @@ -139,8 +138,8 @@ class Category extends BaseAction implements EventSubscriberInterface return $this->genericUpdatePosition(CategoryQuery::create(), $event); } - public function addContent(CategoryAddContentEvent $event) { - + public function addContent(CategoryAddContentEvent $event) + { if (CategoryAssociatedContentQuery::create() ->filterByContentId($event->getContentId()) ->filterByCategory($event->getCategory())->count() <= 0) { @@ -156,8 +155,8 @@ class Category extends BaseAction implements EventSubscriberInterface } } - public function removeContent(CategoryDeleteContentEvent $event) { - + public function removeContent(CategoryDeleteContentEvent $event) + { $content = CategoryAssociatedContentQuery::create() ->filterByContentId($event->getContentId()) ->filterByCategory($event->getCategory())->findOne() @@ -170,7 +169,6 @@ class Category extends BaseAction implements EventSubscriberInterface } } - /** * {@inheritDoc} */ diff --git a/core/lib/Thelia/Action/Content.php b/core/lib/Thelia/Action/Content.php index 4e59cafad..af88fbe2b 100644 --- a/core/lib/Thelia/Action/Content.php +++ b/core/lib/Thelia/Action/Content.php @@ -31,8 +31,6 @@ use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Model\ContentQuery; use Thelia\Model\Content as ContentModel; -use Thelia\Model\FolderQuery; - /** * Class Content @@ -82,11 +80,10 @@ class Content extends BaseAction implements EventSubscriberInterface public function updatePosition(UpdatePositionEvent $event) { - if(null !== $content = ContentQuery::create()->findPk($event->getObjectId())) { + if (null !== $content = ContentQuery::create()->findPk($event->getObjectId())) { $content->setDispatcher($this->getDispatcher()); - switch($event->getMode()) - { + switch ($event->getMode()) { case UpdatePositionEvent::POSITION_ABSOLUTE: $content->changeAbsolutePosition($event->getPosition()); break; @@ -124,7 +121,6 @@ class Content extends BaseAction implements EventSubscriberInterface } } - /** * Returns an array of event names this subscriber wants to listen to. * @@ -157,4 +153,4 @@ class Content extends BaseAction implements EventSubscriberInterface ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/Document.php b/core/lib/Thelia/Action/Document.php index 5b5f2b94e..f048c208e 100644 --- a/core/lib/Thelia/Action/Document.php +++ b/core/lib/Thelia/Action/Document.php @@ -33,11 +33,7 @@ use Thelia\Model\ConfigQuery; use Thelia\Tools\FileManager; use Thelia\Tools\URL; -use Imagine\Document\ImagineInterface; -use Imagine\Document\DocumentInterface; -use Imagine\Document\Box; use Imagine\Document\Color; -use Imagine\Document\Point; use Thelia\Exception\DocumentException; use Thelia\Core\Event\TheliaEvents; @@ -80,7 +76,8 @@ class Document extends BaseCachedFile implements EventSubscriberInterface /** * @return string root of the document cache directory in web space */ - protected function getCacheDirFromWebRoot() { + protected function getCacheDirFromWebRoot() + { return ConfigQuery::read('document_cache_dir_from_web_root', 'cache'); } @@ -95,7 +92,7 @@ class Document extends BaseCachedFile implements EventSubscriberInterface * @param DocumentEvent $event Event * * @throws \Thelia\Exception\DocumentException - * @throws \InvalidArgumentException , DocumentException + * @throws \InvalidArgumentException , DocumentException */ public function processDocument(DocumentEvent $event) { @@ -247,7 +244,7 @@ class Document extends BaseCachedFile implements EventSubscriberInterface 'document' ) ); - } catch(\Exception $e) { + } catch (\Exception $e) { $this->adminLogAppend( $this->container->get('thelia.translator')->trans( 'Fail to delete document for %id% with parent id %parentId% (Exception : %e%)', diff --git a/core/lib/Thelia/Action/Feature.php b/core/lib/Thelia/Action/Feature.php index f141eba83..6ae7645e3 100644 --- a/core/lib/Thelia/Action/Feature.php +++ b/core/lib/Thelia/Action/Feature.php @@ -33,11 +33,7 @@ use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\Feature\FeatureUpdateEvent; use Thelia\Core\Event\Feature\FeatureCreateEvent; use Thelia\Core\Event\Feature\FeatureDeleteEvent; -use Thelia\Model\ConfigQuery; -use Thelia\Model\FeatureAv; -use Thelia\Model\FeatureAvQuery; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Core\Event\Category\CategoryEvent; use Thelia\Core\Event\Feature\FeatureEvent; use Thelia\Model\FeatureTemplate; use Thelia\Model\FeatureTemplateQuery; @@ -130,7 +126,7 @@ class Feature extends BaseAction implements EventSubscriberInterface { $templates = TemplateQuery::create()->find(); - foreach($templates as $template) { + foreach ($templates as $template) { $feature_template = new FeatureTemplate(); @@ -171,4 +167,4 @@ class Feature extends BaseAction implements EventSubscriberInterface ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/FeatureAv.php b/core/lib/Thelia/Action/FeatureAv.php index df2127ebc..c2ef4f7bc 100644 --- a/core/lib/Thelia/Action/FeatureAv.php +++ b/core/lib/Thelia/Action/FeatureAv.php @@ -33,7 +33,6 @@ use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\Feature\FeatureAvUpdateEvent; use Thelia\Core\Event\Feature\FeatureAvCreateEvent; use Thelia\Core\Event\Feature\FeatureAvDeleteEvent; -use Thelia\Model\ConfigQuery; use Thelia\Core\Event\UpdatePositionEvent; class FeatureAv extends BaseAction implements EventSubscriberInterface @@ -115,7 +114,6 @@ class FeatureAv extends BaseAction implements EventSubscriberInterface return $this->genericUpdatePosition(FeatureAvQuery::create(), $event); } - /** * {@inheritDoc} */ @@ -128,4 +126,4 @@ class FeatureAv extends BaseAction implements EventSubscriberInterface TheliaEvents::FEATURE_AV_UPDATE_POSITION => array("updatePosition", 128), ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/Folder.php b/core/lib/Thelia/Action/Folder.php index a9dd31725..636b8eab7 100644 --- a/core/lib/Thelia/Action/Folder.php +++ b/core/lib/Thelia/Action/Folder.php @@ -32,15 +32,13 @@ use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Model\FolderQuery; use Thelia\Model\Folder as FolderModel; - /** * Class Folder * @package Thelia\Action * @author Manuel Raynaud */ -class Folder extends BaseAction implements EventSubscriberInterface { - - +class Folder extends BaseAction implements EventSubscriberInterface +{ public function update(FolderUpdateEvent $event) { @@ -103,11 +101,10 @@ class Folder extends BaseAction implements EventSubscriberInterface { public function updatePosition(UpdatePositionEvent $event) { - if(null !== $folder = FolderQuery::create()->findPk($event->getObjectId())) { + if (null !== $folder = FolderQuery::create()->findPk($event->getObjectId())) { $folder->setDispatcher($this->getDispatcher()); - switch($event->getMode()) - { + switch ($event->getMode()) { case UpdatePositionEvent::POSITION_ABSOLUTE: $folder->changeAbsolutePosition($event->getPosition()); break; @@ -152,4 +149,4 @@ class Folder extends BaseAction implements EventSubscriberInterface { TheliaEvents::FOLDER_UPDATE_POSITION => array("updatePosition", 128), ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/HttpException.php b/core/lib/Thelia/Action/HttpException.php index 9beadeb7b..50ee92d5e 100755 --- a/core/lib/Thelia/Action/HttpException.php +++ b/core/lib/Thelia/Action/HttpException.php @@ -45,7 +45,7 @@ class HttpException extends BaseAction implements EventSubscriberInterface $this->display404($event); } - if($event->getException() instanceof AccessDeniedHttpException) { + if ($event->getException() instanceof AccessDeniedHttpException) { $this->display403($event); } } diff --git a/core/lib/Thelia/Action/Image.php b/core/lib/Thelia/Action/Image.php index d93f39cf0..97d4bd095 100755 --- a/core/lib/Thelia/Action/Image.php +++ b/core/lib/Thelia/Action/Image.php @@ -23,19 +23,12 @@ namespace Thelia\Action; -use Propel\Runtime\ActiveRecord\ActiveRecordInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\File\UploadedFile; use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent; -use Thelia\Core\Event\ImagesCreateOrUpdateEvent; use Thelia\Core\Event\Image\ImageDeleteEvent; use Thelia\Core\Event\Image\ImageEvent; -use Thelia\Model\CategoryImage; use Thelia\Model\ConfigQuery; -use Thelia\Model\ContentImage; -use Thelia\Model\FolderImage; -use Thelia\Model\ProductImage; use Thelia\Tools\FileManager; use Thelia\Tools\URL; @@ -88,12 +81,11 @@ class Image extends BaseCachedFile implements EventSubscriberInterface const EXACT_RATIO_WITH_CROP = 2; const KEEP_IMAGE_RATIO = 3; - - /** * @return string root of the image cache directory in web space */ - protected function getCacheDirFromWebRoot() { + protected function getCacheDirFromWebRoot() + { return ConfigQuery::read('image_cache_dir_from_web_root', 'cache'); } @@ -106,8 +98,8 @@ class Image extends BaseCachedFile implements EventSubscriberInterface * * This method updates the cache_file_path and file_url attributes of the event * - * @param \Thelia\Core\Event\Image\ImageEvent $event - * @throws \InvalidArgumentException, ImageException + * @param \Thelia\Core\Event\Image\ImageEvent $event + * @throws \InvalidArgumentException, ImageException */ public function processImage(ImageEvent $event) { @@ -358,7 +350,7 @@ class Image extends BaseCachedFile implements EventSubscriberInterface 'image' ) ); - } catch(\Exception $e){ + } catch (\Exception $e) { $this->adminLogAppend( $this->container->get('thelia.translator')->trans( 'Fail to delete image for %id% with parent id %parentId% (Exception : %e%)', diff --git a/core/lib/Thelia/Action/Order.php b/core/lib/Thelia/Action/Order.php index 58f2ff1cd..b48f72439 100755 --- a/core/lib/Thelia/Action/Order.php +++ b/core/lib/Thelia/Action/Order.php @@ -23,13 +23,11 @@ namespace Thelia\Action; -use Propel\Runtime\ActiveQuery\ModelCriteria; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Thelia\Core\Event\Order\OrderAddressEvent; use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Exception\OrderException; use Thelia\Exception\TheliaProcessException; use Thelia\Model\AddressQuery; use Thelia\Model\OrderProductAttributeCombination; @@ -39,7 +37,6 @@ use Thelia\Model\OrderStatus; use Thelia\Model\Map\OrderTableMap; use Thelia\Model\OrderAddress; use Thelia\Model\OrderStatusQuery; -use Thelia\Model\ConfigQuery; use Thelia\Tools\I18n; /** @@ -177,7 +174,7 @@ class Order extends BaseAction implements EventSubscriberInterface /* fulfill order_products and decrease stock */ - foreach($cartItems as $cartItem) { + foreach ($cartItems as $cartItem) { $product = $cartItem->getProduct(); /* get translation */ @@ -186,7 +183,7 @@ class Order extends BaseAction implements EventSubscriberInterface $pse = $cartItem->getProductSaleElements(); /* check still in stock */ - if($cartItem->getQuantity() > $pse->getQuantity()) { + if ($cartItem->getQuantity() > $pse->getQuantity()) { throw new TheliaProcessException("Not enough stock", TheliaProcessException::CART_ITEM_NOT_ENOUGH_STOCK, $cartItem); } @@ -228,13 +225,13 @@ class Order extends BaseAction implements EventSubscriberInterface $orderProduct->save($con); /* fulfill order_product_tax */ - foreach($taxDetail as $tax) { + foreach ($taxDetail as $tax) { $tax->setOrderProductId($orderProduct->getId()); $tax->save($con); } /* fulfill order_attribute_combination and decrease stock */ - foreach($pse->getAttributeCombinations() as $attributeCombination) { + foreach ($pse->getAttributeCombinations() as $attributeCombination) { $attribute = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'Attribute', $attributeCombination->getAttributeId()); $attributeAv = I18n::forceI18nRetrieving($this->getSession()->getLang()->getLocale(), 'AttributeAv', $attributeCombination->getAttributeAvId()); diff --git a/core/lib/Thelia/Action/Product.php b/core/lib/Thelia/Action/Product.php index 762ec2392..bd918c5e6 100644 --- a/core/lib/Thelia/Action/Product.php +++ b/core/lib/Thelia/Action/Product.php @@ -33,7 +33,6 @@ use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\Product\ProductUpdateEvent; use Thelia\Core\Event\Product\ProductCreateEvent; use Thelia\Core\Event\Product\ProductDeleteEvent; -use Thelia\Model\ConfigQuery; use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Core\Event\Product\ProductToggleVisibilityEvent; use Thelia\Core\Event\Product\ProductAddContentEvent; @@ -41,21 +40,16 @@ use Thelia\Core\Event\Product\ProductDeleteContentEvent; use Thelia\Model\ProductAssociatedContent; use Thelia\Model\ProductAssociatedContentQuery; use Thelia\Model\ProductCategory; -use Thelia\Model\TaxRule; use Thelia\Model\TaxRuleQuery; -use Thelia\Model\TaxQuery; use Thelia\Model\AccessoryQuery; use Thelia\Model\Accessory; use Thelia\Core\Event\FeatureProduct\FeatureProductUpdateEvent; use Thelia\Model\FeatureProduct; -use Thelia\Model\FeatureQuery; use Thelia\Core\Event\FeatureProduct\FeatureProductDeleteEvent; use Thelia\Model\FeatureProductQuery; use Thelia\Model\ProductCategoryQuery; use Thelia\Core\Event\Product\ProductSetTemplateEvent; -use Thelia\Model\AttributeCombinationQuery; use Thelia\Model\ProductSaleElementsQuery; -use Propel\Runtime\ActiveQuery\PropelQuery; use Thelia\Core\Event\Product\ProductDeleteCategoryEvent; use Thelia\Core\Event\Product\ProductAddCategoryEvent; use Thelia\Model\AttributeAvQuery; @@ -181,8 +175,8 @@ class Product extends BaseAction implements EventSubscriberInterface return $this->genericUpdatePosition(ProductQuery::create(), $event); } - public function addContent(ProductAddContentEvent $event) { - + public function addContent(ProductAddContentEvent $event) + { if (ProductAssociatedContentQuery::create() ->filterByContentId($event->getContentId()) ->filterByProduct($event->getProduct())->count() <= 0) { @@ -198,8 +192,8 @@ class Product extends BaseAction implements EventSubscriberInterface } } - public function removeContent(ProductDeleteContentEvent $event) { - + public function removeContent(ProductDeleteContentEvent $event) + { $content = ProductAssociatedContentQuery::create() ->filterByContentId($event->getContentId()) ->filterByProduct($event->getProduct())->findOne() @@ -212,8 +206,8 @@ class Product extends BaseAction implements EventSubscriberInterface ; } - public function addCategory(ProductAddCategoryEvent $event) { - + public function addCategory(ProductAddCategoryEvent $event) + { if (ProductCategoryQuery::create() ->filterByProduct($event->getProduct()) ->filterByCategoryId($event->getCategoryId()) @@ -230,8 +224,8 @@ class Product extends BaseAction implements EventSubscriberInterface } } - public function removeCategory(ProductDeleteCategoryEvent $event) { - + public function removeCategory(ProductDeleteCategoryEvent $event) + { $productCategory = ProductCategoryQuery::create() ->filterByProduct($event->getProduct()) ->filterByCategoryId($event->getCategoryId()) @@ -240,8 +234,8 @@ class Product extends BaseAction implements EventSubscriberInterface if ($productCategory != null) $productCategory->delete(); } - public function addAccessory(ProductAddAccessoryEvent $event) { - + public function addAccessory(ProductAddAccessoryEvent $event) + { if (AccessoryQuery::create() ->filterByAccessory($event->getAccessoryId()) ->filterByProductId($event->getProduct()->getId())->count() <= 0) { @@ -257,8 +251,8 @@ class Product extends BaseAction implements EventSubscriberInterface } } - public function removeAccessory(ProductDeleteAccessoryEvent $event) { - + public function removeAccessory(ProductDeleteAccessoryEvent $event) + { $accessory = AccessoryQuery::create() ->filterByAccessory($event->getAccessoryId()) ->filterByProductId($event->getProduct()->getId())->findOne() @@ -271,8 +265,8 @@ class Product extends BaseAction implements EventSubscriberInterface ; } - public function setProductTemplate(ProductSetTemplateEvent $event) { - + public function setProductTemplate(ProductSetTemplateEvent $event) + { $product = $event->getProduct(); // Delete all product feature relations @@ -310,8 +304,8 @@ class Product extends BaseAction implements EventSubscriberInterface return $this->genericUpdatePosition(ProductAssociatedContentQuery::create(), $event); } - public function updateFeatureProductValue(FeatureProductUpdateEvent $event) { - + public function updateFeatureProductValue(FeatureProductUpdateEvent $event) + { // If the feature is not free text, it may have one ore more values. // If the value exists, we do not change it // If the value does not exists, we create it. @@ -343,8 +337,7 @@ class Product extends BaseAction implements EventSubscriberInterface if ($event->getIsTextValue() == true) { $featureProduct->setFreeTextValue($event->getFeatureValue()); - } - else { + } else { $featureProduct->setFeatureAvId($event->getFeatureValue()); } @@ -353,8 +346,8 @@ class Product extends BaseAction implements EventSubscriberInterface $event->setFeatureProduct($featureProduct); } - public function deleteFeatureProductValue(FeatureProductDeleteEvent $event) { - + public function deleteFeatureProductValue(FeatureProductDeleteEvent $event) + { $featureProduct = FeatureProductQuery::create() ->filterByProductId($event->getProductId()) ->filterByFeatureId($event->getFeatureId()) @@ -362,8 +355,8 @@ class Product extends BaseAction implements EventSubscriberInterface ; } - public function createProductCombination(ProductCreateCombinationEvent $event) { - + public function createProductCombination(ProductCreateCombinationEvent $event) + { $con = Propel::getWriteConnection(ProductTableMap::DATABASE_NAME); $con->beginTransaction(); @@ -399,7 +392,7 @@ class Product extends BaseAction implements EventSubscriberInterface if (count($combinationAttributes) > 0) { - foreach($combinationAttributes as $attributeAvId) { + foreach ($combinationAttributes as $attributeAvId) { $attributeAv = AttributeAvQuery::create()->findPk($attributeAvId); @@ -417,8 +410,7 @@ class Product extends BaseAction implements EventSubscriberInterface // Store all the stuff ! $con->commit(); - } - catch(\Exception $ex) { + } catch (\Exception $ex) { $con->rollback(); @@ -426,8 +418,8 @@ class Product extends BaseAction implements EventSubscriberInterface } } - public function deleteProductCombination(ProductDeleteCombinationEvent $event) { - + public function deleteProductCombination(ProductDeleteCombinationEvent $event) + { if (null !== $pse = ProductSaleElementsQuery::create()->findPk($event->getProductSaleElementId())) { $pse->delete(); } diff --git a/core/lib/Thelia/Action/Template.php b/core/lib/Thelia/Action/Template.php index e387ed615..c5ea6b03e 100644 --- a/core/lib/Thelia/Action/Template.php +++ b/core/lib/Thelia/Action/Template.php @@ -33,14 +33,7 @@ use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\Template\TemplateUpdateEvent; use Thelia\Core\Event\Template\TemplateCreateEvent; use Thelia\Core\Event\Template\TemplateDeleteEvent; -use Thelia\Model\ConfigQuery; -use Thelia\Model\TemplateAv; -use Thelia\Model\TemplateAvQuery; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Core\Event\Category\CategoryEvent; -use Thelia\Core\Event\Template\TemplateEvent; -use Thelia\Model\TemplateTemplate; -use Thelia\Model\TemplateTemplateQuery; use Thelia\Model\ProductQuery; use Thelia\Core\Event\Template\TemplateAddAttributeEvent; use Thelia\Core\Event\Template\TemplateDeleteAttributeEvent; @@ -121,8 +114,8 @@ class Template extends BaseAction implements EventSubscriberInterface } } - public function addAttribute(TemplateAddAttributeEvent $event) { - + public function addAttribute(TemplateAddAttributeEvent $event) + { if (null === AttributeTemplateQuery::create()->filterByAttributeId($event->getAttributeId())->filterByTemplate($event->getTemplate())->findOne()) { $attribute_template = new AttributeTemplate(); @@ -155,8 +148,8 @@ class Template extends BaseAction implements EventSubscriberInterface return $this->genericUpdatePosition(FeatureTemplateQuery::create(), $event); } - public function deleteAttribute(TemplateDeleteAttributeEvent $event) { - + public function deleteAttribute(TemplateDeleteAttributeEvent $event) + { $attribute_template = AttributeTemplateQuery::create() ->filterByAttributeId($event->getAttributeId()) ->filterByTemplate($event->getTemplate())->findOne() @@ -165,8 +158,8 @@ class Template extends BaseAction implements EventSubscriberInterface if ($attribute_template !== null) $attribute_template->delete(); } - public function addFeature(TemplateAddFeatureEvent $event) { - + public function addFeature(TemplateAddFeatureEvent $event) + { if (null === FeatureTemplateQuery::create()->filterByFeatureId($event->getFeatureId())->filterByTemplate($event->getTemplate())->findOne()) { $feature_template = new FeatureTemplate(); @@ -179,8 +172,8 @@ class Template extends BaseAction implements EventSubscriberInterface } } - public function deleteFeature(TemplateDeleteFeatureEvent $event) { - + public function deleteFeature(TemplateDeleteFeatureEvent $event) + { $feature_template = FeatureTemplateQuery::create() ->filterByFeatureId($event->getFeatureId()) ->filterByTemplate($event->getTemplate())->findOne() @@ -210,4 +203,4 @@ class Template extends BaseAction implements EventSubscriberInterface ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Command/CacheClear.php b/core/lib/Thelia/Command/CacheClear.php index 1126f99a6..e85e29741 100755 --- a/core/lib/Thelia/Command/CacheClear.php +++ b/core/lib/Thelia/Command/CacheClear.php @@ -73,10 +73,11 @@ class CacheClear extends ContainerAwareCommand try { $directoryBrowser = new \DirectoryIterator($dir); - } catch(\UnexpectedValueException $e) { + } catch (\UnexpectedValueException $e) { // throws same exception code for does not exist and permission denied ... - if(!file_exists($dir)) { + if (!file_exists($dir)) { $output->writeln(sprintf("%s cache dir already clear", $dir)); + return; } diff --git a/core/lib/Thelia/Command/ModuleActivateCommand.php b/core/lib/Thelia/Command/ModuleActivateCommand.php index cddfd5290..d5ca8156d 100755 --- a/core/lib/Thelia/Command/ModuleActivateCommand.php +++ b/core/lib/Thelia/Command/ModuleActivateCommand.php @@ -25,12 +25,9 @@ namespace Thelia\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Filesystem\Filesystem; -use Symfony\Component\Filesystem\Exception\IOException; -use Thelia\Command\ContainerAwareCommand; use Thelia\Model\ModuleQuery; /** @@ -62,7 +59,7 @@ class ModuleActivateCommand extends BaseModuleGenerate $module = ModuleQuery::create()->findOneByCode($moduleCode); - if(null === $module) { + if (null === $module) { throw new \RuntimeException(sprintf("module %s not found", $moduleCode)); } @@ -74,7 +71,7 @@ class ModuleActivateCommand extends BaseModuleGenerate $moduleInstance = $moduleReflection->newInstance(); $moduleInstance->activate(); - } catch(\Exception $e) { + } catch (\Exception $e) { throw new \RuntimeException(sprintf("Activation fail with Exception : [%d] %s", $e->getCode(), $e->getMessage())); } diff --git a/core/lib/Thelia/Command/ReloadDatabaseCommand.php b/core/lib/Thelia/Command/ReloadDatabaseCommand.php index 311b20552..20aad0265 100644 --- a/core/lib/Thelia/Command/ReloadDatabaseCommand.php +++ b/core/lib/Thelia/Command/ReloadDatabaseCommand.php @@ -56,7 +56,7 @@ class ReloadDatabaseCommand extends BaseModuleGenerate $tables = $connection->query("SHOW TABLES"); $connection->query("SET FOREIGN_KEY_CHECKS = 0"); - foreach($tables as $table) { + foreach ($tables as $table) { $connection->query(sprintf("DROP TABLE `%s`", $table[0])); } $connection->query("SET FOREIGN_KEY_CHECKS = 1"); diff --git a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php index d2e7e5508..170c35c4f 100644 --- a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php +++ b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php @@ -25,7 +25,6 @@ namespace Thelia\Controller\Admin; use Thelia\Form\Exception\FormValidationException; use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Core\Event\ToggleVisibilityEvent; /** * An abstract CRUD controller for Thelia ADMIN, to manage basic CRUD operations on a givent object. @@ -53,14 +52,13 @@ abstract class AbstractCrudController extends BaseAdminController protected $visibilityToggleEventIdentifier; protected $changePositionEventIdentifier; - /** * @param string $objectName the lower case object name. Example. "message" * - * @param string $defaultListOrder the default object list order, or null if list is not sortable. Example: manual + * @param string $defaultListOrder the default object list order, or null if list is not sortable. Example: manual * @param string $orderRequestParameterName Name of the request parameter that set the list order (null if list is not sortable) * - * @param string $viewPermissionIdentifier the 'view' permission identifier. Example: "admin.configuration.message.view" + * @param string $viewPermissionIdentifier the 'view' permission identifier. Example: "admin.configuration.message.view" * @param string $createPermissionIdentifier the 'create' permission identifier. Example: "admin.configuration.message.create" * @param string $updatePermissionIdentifier the 'update' permission identifier. Example: "admin.configuration.message.update" * @param string $deletePermissionIdentifier the 'delete' permission identifier. Example: "admin.configuration.message.delete" @@ -70,7 +68,7 @@ abstract class AbstractCrudController extends BaseAdminController * @param string $deleteEventIdentifier the dispatched delete TheliaEvent identifier. Example: TheliaEvents::MESSAGE_DELETE * * @param string $visibilityToggleEventIdentifier the dispatched visibility toggle TheliaEvent identifier, or null if the object has no visible options. Example: TheliaEvents::MESSAGE_TOGGLE_VISIBILITY - * @param string $changePositionEventIdentifier the dispatched position change TheliaEvent identifier, or null if the object has no position. Example: TheliaEvents::MESSAGE_UPDATE_POSITION + * @param string $changePositionEventIdentifier the dispatched position change TheliaEvent identifier, or null if the object has no position. Example: TheliaEvents::MESSAGE_UPDATE_POSITION */ public function __construct( $objectName, @@ -109,94 +107,93 @@ abstract class AbstractCrudController extends BaseAdminController /** * Return the creation form for this object */ - protected abstract function getCreationForm(); + abstract protected function getCreationForm(); /** * Return the update form for this object */ - protected abstract function getUpdateForm(); + abstract protected function getUpdateForm(); /** * Hydrate the update form for this object, before passing it to the update template * * @param unknown $object */ - protected abstract function hydrateObjectForm($object); + abstract protected function hydrateObjectForm($object); /** * Creates the creation event with the provided form data * * @param unknown $formData */ - protected abstract function getCreationEvent($formData); + abstract protected function getCreationEvent($formData); /** * Creates the update event with the provided form data * * @param unknown $formData */ - protected abstract function getUpdateEvent($formData); + abstract protected function getUpdateEvent($formData); /** * Creates the delete event with the provided form data */ - protected abstract function getDeleteEvent(); + abstract protected function getDeleteEvent(); /** * Return true if the event contains the object, e.g. the action has updated the object in the event. * * @param unknown $event */ - protected abstract function eventContainsObject($event); + abstract protected function eventContainsObject($event); /** * Get the created object from an event. * * @param unknown $createEvent */ - protected abstract function getObjectFromEvent($event); + abstract protected function getObjectFromEvent($event); /** * Load an existing object from the database */ - protected abstract function getExistingObject(); + abstract protected function getExistingObject(); /** * Returns the object label form the object event (name, title, etc.) * * @param unknown $object */ - protected abstract function getObjectLabel($object); + abstract protected function getObjectLabel($object); /** * Returns the object ID from the object * * @param unknown $object */ - protected abstract function getObjectId($object); + abstract protected function getObjectId($object); /** * Render the main list template * * @param unknown $currentOrder, if any, null otherwise. */ - protected abstract function renderListTemplate($currentOrder); + abstract protected function renderListTemplate($currentOrder); /** * Render the edition template */ - protected abstract function renderEditionTemplate(); + abstract protected function renderEditionTemplate(); /** * Redirect to the edition template */ - protected abstract function redirectToEditionTemplate(); + abstract protected function redirectToEditionTemplate(); /** * Redirect to the list template */ - protected abstract function redirectToListTemplate(); - + abstract protected function redirectToListTemplate(); protected function createUpdatePositionEvent($positionChangeMode, $positionValue) { @@ -211,7 +208,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * Put in this method post object creation processing if required. * - * @param unknown $createEvent the create event + * @param unknown $createEvent the create event * @return Response a response, or null to continue normal processing */ protected function performAdditionalCreateAction($createEvent) @@ -222,7 +219,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * Put in this method post object update processing if required. * - * @param unknown $updateEvent the update event + * @param unknown $updateEvent the update event * @return Response a response, or null to continue normal processing */ protected function performAdditionalUpdateAction($updateEvent) @@ -233,7 +230,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * Put in this method post object delete processing if required. * - * @param unknown $deleteEvent the delete event + * @param unknown $deleteEvent the delete event * @return Response a response, or null to continue normal processing */ protected function performAdditionalDeleteAction($deleteEvent) @@ -244,7 +241,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * Put in this method post object position change processing if required. * - * @param unknown $deleteEvent the delete event + * @param unknown $deleteEvent the delete event * @return Response a response, or null to continue normal processing */ protected function performAdditionalUpdatePositionAction($positionChangeEvent) @@ -282,7 +279,6 @@ abstract class AbstractCrudController extends BaseAdminController public function defaultAction() { if (null !== $response = $this->checkAuth($this->viewPermissionIdentifier)) return $response; - return $this->renderList(); } @@ -323,22 +319,19 @@ abstract class AbstractCrudController extends BaseAdminController $response = $this->performAdditionalCreateAction($createEvent); - if ($response == null) { + if ($response == null) { // Substitute _ID_ in the URL with the ID of the created object $successUrl = str_replace('_ID_', $this->getObjectId($createdObject), $creationForm->getSuccessUrl()); // Redirect to the success URL $this->redirect($successUrl); - } - else { + } else { return $response; } - } - catch (FormValidationException $ex) { + } catch (FormValidationException $ex) { // Form cannot be validated $error_msg = $this->createStandardFormValidationErrorMessage($ex); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any other error $error_msg = $ex->getMessage(); } @@ -423,16 +416,13 @@ abstract class AbstractCrudController extends BaseAdminController // Redirect to the success URL $this->redirect($changeForm->getSuccessUrl()); - } - else { + } else { return $response; } - } - catch (FormValidationException $ex) { + } catch (FormValidationException $ex) { // Form cannot be validated $error_msg = $this->createStandardFormValidationErrorMessage($ex); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any other error $error_msg = $ex->getMessage(); } @@ -469,8 +459,7 @@ abstract class AbstractCrudController extends BaseAdminController $event = $this->createUpdatePositionEvent($mode, $position); $this->dispatch($this->changePositionEventIdentifier, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -479,14 +468,13 @@ abstract class AbstractCrudController extends BaseAdminController if ($response == null) { $this->redirectToListTemplate(); - } - else { + } else { return $response; } } - protected function genericUpdatePositionAction($object, $eventName, $doFinalRedirect = true) { - + protected function genericUpdatePositionAction($object, $eventName, $doFinalRedirect = true) + { // Check current user authorization if (null !== $response = $this->checkAuth($this->updatePermissionIdentifier)) return $response; @@ -507,8 +495,7 @@ abstract class AbstractCrudController extends BaseAdminController $event = new UpdatePositionEvent($object->getId(), $mode, $position); $this->dispatch($eventName, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } diff --git a/core/lib/Thelia/Controller/Admin/AdminController.php b/core/lib/Thelia/Controller/Admin/AdminController.php index 2d3d80df1..0b76c79ff 100755 --- a/core/lib/Thelia/Controller/Admin/AdminController.php +++ b/core/lib/Thelia/Controller/Admin/AdminController.php @@ -23,10 +23,6 @@ namespace Thelia\Controller\Admin; -use Thelia\Core\Security\Authentication\AdminTokenAuthenticator; -use Thelia\Model\ConfigQuery; -use Thelia\Core\Security\Exception\TokenAuthenticationException; - class AdminController extends BaseAdminController { public function indexAction() @@ -36,6 +32,6 @@ class AdminController extends BaseAdminController public function updateAction() { - return $this->render("profile-edit"); + return $this->render("profile-edit"); } } diff --git a/core/lib/Thelia/Controller/Admin/AttributeAvController.php b/core/lib/Thelia/Controller/Admin/AttributeAvController.php index 2afe66a38..bc6984e9e 100644 --- a/core/lib/Thelia/Controller/Admin/AttributeAvController.php +++ b/core/lib/Thelia/Controller/Admin/AttributeAvController.php @@ -193,4 +193,4 @@ class AttributeAvController extends AbstractCrudController $this->getViewArguments() ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/AttributeController.php b/core/lib/Thelia/Controller/Admin/AttributeController.php index 0b2ad9850..689b92a01 100644 --- a/core/lib/Thelia/Controller/Admin/AttributeController.php +++ b/core/lib/Thelia/Controller/Admin/AttributeController.php @@ -113,7 +113,7 @@ class AttributeController extends AbstractCrudController if ($attr_values !== null) { - foreach($attr_values as $id => $value) { + foreach ($attr_values as $id => $value) { $event = new AttributeAvUpdateEvent($id); @@ -168,7 +168,7 @@ class AttributeController extends AbstractCrudController $attr_array = array(); - foreach($attr_av_list as $attr_av) { + foreach ($attr_av_list as $attr_av) { $attr_array[$attr_av->getId()] = $attr_av->getTitle(); } @@ -262,8 +262,7 @@ class AttributeController extends AbstractCrudController $this->dispatch($eventType, $event); } - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -286,4 +285,4 @@ class AttributeController extends AbstractCrudController { return $this->addRemoveFromAllTemplates(TheliaEvents::ATTRIBUTE_ADD_TO_ALL_TEMPLATES); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/BaseAdminController.php b/core/lib/Thelia/Controller/Admin/BaseAdminController.php index fa505b5c3..d80d8ce9f 100755 --- a/core/lib/Thelia/Controller/Admin/BaseAdminController.php +++ b/core/lib/Thelia/Controller/Admin/BaseAdminController.php @@ -293,20 +293,19 @@ class BaseAdminController extends BaseController return $this->getCurrentEditionLang()->getLocale(); } - /** * Return the current list order identifier for a given object name, * updating in using the current request. * - * @param unknown $objectName the object name (e.g. 'attribute', 'message') + * @param unknown $objectName the object name (e.g. 'attribute', 'message') * @param unknown $requestParameterName the name of the request parameter that defines the list order - * @param unknown $defaultListOrder the default order to use, if none is defined - * @param string $updateSession if true, the session will be updated with the current order. + * @param unknown $defaultListOrder the default order to use, if none is defined + * @param string $updateSession if true, the session will be updated with the current order. * * @return String the current liste order. */ - protected function getListOrderFromSession($objectName, $requestParameterName, $defaultListOrder, $updateSession = true) { - + protected function getListOrderFromSession($objectName, $requestParameterName, $defaultListOrder, $updateSession = true) + { $order = $defaultListOrder; $orderSessionIdentifier = sprintf("admin.%s.currentListOrder", $objectName); @@ -318,7 +317,6 @@ class BaseAdminController extends BaseController ); if ($updateSession) $this->getSession()->set($orderSessionIdentifier, $order); - return $order; } @@ -353,8 +351,8 @@ class BaseAdminController extends BaseController /** Clear the remember me cookie. * */ - protected function clearRememberMeCookie() { - + protected function clearRememberMeCookie() + { $ctp = new CookieTokenProvider(); $cookieName = ConfigQuery::read('admin_remember_me_cookie_name', 'armcn'); diff --git a/core/lib/Thelia/Controller/Admin/CategoryController.php b/core/lib/Thelia/Controller/Admin/CategoryController.php index e2a85913d..ff2dae1e4 100755 --- a/core/lib/Thelia/Controller/Admin/CategoryController.php +++ b/core/lib/Thelia/Controller/Admin/CategoryController.php @@ -24,7 +24,6 @@ namespace Thelia\Controller\Admin; use Symfony\Component\HttpFoundation\Response; -use Thelia\Log\Tlog; use Thelia\Core\Event\Category\CategoryDeleteEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\Category\CategoryUpdateEvent; @@ -36,7 +35,6 @@ use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Core\Event\Category\CategoryToggleVisibilityEvent; use Thelia\Core\Event\Category\CategoryDeleteContentEvent; use Thelia\Core\Event\Category\CategoryAddContentEvent; -use Thelia\Model\CategoryAssociatedContent; use Thelia\Model\FolderQuery; use Thelia\Model\ContentQuery; use Propel\Runtime\ActiveQuery\Criteria; @@ -49,7 +47,8 @@ use Thelia\Model\CategoryAssociatedContentQuery; */ class CategoryController extends AbstractCrudController { - public function __construct() { + public function __construct() + { parent::__construct( 'category', 'manual', @@ -68,15 +67,18 @@ class CategoryController extends AbstractCrudController ); } - protected function getCreationForm() { + protected function getCreationForm() + { return new CategoryCreationForm($this->getRequest()); } - protected function getUpdateForm() { + protected function getUpdateForm() + { return new CategoryModificationForm($this->getRequest()); } - protected function getCreationEvent($formData) { + protected function getCreationEvent($formData) + { $createEvent = new CategoryCreateEvent(); $createEvent @@ -89,7 +91,8 @@ class CategoryController extends AbstractCrudController return $createEvent; } - protected function getUpdateEvent($formData) { + protected function getUpdateEvent($formData) + { $changeEvent = new CategoryUpdateEvent($formData['id']); // Create and dispatch the change event @@ -107,8 +110,8 @@ class CategoryController extends AbstractCrudController return $changeEvent; } - protected function createUpdatePositionEvent($positionChangeMode, $positionValue) { - + protected function createUpdatePositionEvent($positionChangeMode, $positionValue) + { return new UpdatePositionEvent( $this->getRequest()->get('category_id', null), $positionChangeMode, @@ -116,16 +119,18 @@ class CategoryController extends AbstractCrudController ); } - protected function getDeleteEvent() { + protected function getDeleteEvent() + { return new CategoryDeleteEvent($this->getRequest()->get('category_id', 0)); } - protected function eventContainsObject($event) { + protected function eventContainsObject($event) + { return $event->hasCategory(); } - protected function hydrateObjectForm($object) { - + protected function hydrateObjectForm($object) + { // Prepare the data that will hydrate the form $data = array( 'id' => $object->getId(), @@ -143,21 +148,25 @@ class CategoryController extends AbstractCrudController return new CategoryModificationForm($this->getRequest(), "form", $data); } - protected function getObjectFromEvent($event) { + protected function getObjectFromEvent($event) + { return $event->hasCategory() ? $event->getCategory() : null; } - protected function getExistingObject() { + protected function getExistingObject() + { return CategoryQuery::create() ->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('category_id', 0)); } - protected function getObjectLabel($object) { + protected function getObjectLabel($object) + { return $object->getTitle(); } - protected function getObjectId($object) { + protected function getObjectId($object) + { return $object->getId(); } @@ -170,8 +179,8 @@ class CategoryController extends AbstractCrudController ); } - protected function renderListTemplate($currentOrder) { - + protected function renderListTemplate($currentOrder) + { // Get product order $product_order = $this->getListOrderFromSession('product', 'product_order', 'manual'); @@ -183,19 +192,21 @@ class CategoryController extends AbstractCrudController )); } - protected function redirectToListTemplate() { + protected function redirectToListTemplate() + { $this->redirectToRoute( 'admin.categories.default', array('category_id' => $this->getRequest()->get('category_id', 0)) ); } - protected function renderEditionTemplate() { - + protected function renderEditionTemplate() + { return $this->render('category-edit', $this->getEditionArguments()); } - protected function redirectToEditionTemplate() { + protected function redirectToEditionTemplate() + { $this->redirectToRoute("admin.categories.update", $this->getEditionArguments()); } @@ -257,8 +268,8 @@ class CategoryController extends AbstractCrudController return null; } - public function getAvailableRelatedContentAction($categoryId, $folderId) { - + public function getAvailableRelatedContentAction($categoryId, $folderId) + { $result = array(); $folders = FolderQuery::create()->filterById($folderId)->find(); @@ -273,7 +284,7 @@ class CategoryController extends AbstractCrudController ; if ($list !== null) { - foreach($list as $item) { + foreach ($list as $item) { $result[] = array('id' => $item->getId(), 'title' => $item->getTitle()); } } @@ -282,8 +293,8 @@ class CategoryController extends AbstractCrudController return $this->jsonResponse(json_encode($result)); } - public function addRelatedContentAction() { - + public function addRelatedContentAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.categories.update")) return $response; @@ -298,8 +309,7 @@ class CategoryController extends AbstractCrudController try { $this->dispatch(TheliaEvents::CATEGORY_ADD_CONTENT, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -341,8 +351,8 @@ class CategoryController extends AbstractCrudController $this->redirectToEditionTemplate(); } - public function deleteRelatedContentAction() { - + public function deleteRelatedContentAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.categories.update")) return $response; @@ -357,8 +367,7 @@ class CategoryController extends AbstractCrudController try { $this->dispatch(TheliaEvents::CATEGORY_REMOVE_CONTENT, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } diff --git a/core/lib/Thelia/Controller/Admin/ConfigController.php b/core/lib/Thelia/Controller/Admin/ConfigController.php index c1d360ff4..dc19107d8 100644 --- a/core/lib/Thelia/Controller/Admin/ConfigController.php +++ b/core/lib/Thelia/Controller/Admin/ConfigController.php @@ -30,7 +30,6 @@ use Thelia\Core\Event\Config\ConfigCreateEvent; use Thelia\Model\ConfigQuery; use Thelia\Form\ConfigModificationForm; use Thelia\Form\ConfigCreationForm; -use Thelia\Core\Event\UpdatePositionEvent; /** * Manages variables @@ -39,7 +38,8 @@ use Thelia\Core\Event\UpdatePositionEvent; */ class ConfigController extends AbstractCrudController { - public function __construct() { + public function __construct() + { parent::__construct( 'variable', 'name', @@ -58,15 +58,18 @@ class ConfigController extends AbstractCrudController ); } - protected function getCreationForm() { + protected function getCreationForm() + { return new ConfigCreationForm($this->getRequest()); } - protected function getUpdateForm() { + protected function getUpdateForm() + { return new ConfigModificationForm($this->getRequest()); } - protected function getCreationEvent($data) { + protected function getCreationEvent($data) + { $createEvent = new ConfigCreateEvent(); $createEvent @@ -78,11 +81,11 @@ class ConfigController extends AbstractCrudController ->setSecured($data['secured']) ; - return $createEvent; } - protected function getUpdateEvent($data) { + protected function getUpdateEvent($data) + { $changeEvent = new ConfigUpdateEvent($data['id']); // Create and dispatch the change event @@ -101,16 +104,18 @@ class ConfigController extends AbstractCrudController return $changeEvent; } - protected function getDeleteEvent() { + protected function getDeleteEvent() + { return new ConfigDeleteEvent($this->getRequest()->get('variable_id')); } - protected function eventContainsObject($event) { + protected function eventContainsObject($event) + { return $event->hasConfig(); } - protected function hydrateObjectForm($object) { - + protected function hydrateObjectForm($object) + { // Prepare the data that will hydrate the form $data = array( 'id' => $object->getId(), @@ -129,40 +134,48 @@ class ConfigController extends AbstractCrudController return new ConfigModificationForm($this->getRequest(), "form", $data); } - protected function getObjectFromEvent($event) { + protected function getObjectFromEvent($event) + { return $event->hasConfig() ? $event->getConfig() : null; } - protected function getExistingObject() { + protected function getExistingObject() + { return ConfigQuery::create() ->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('variable_id')); } - protected function getObjectLabel($object) { + protected function getObjectLabel($object) + { return $object->getName(); } - protected function getObjectId($object) { + protected function getObjectId($object) + { return $object->getId(); } - protected function renderListTemplate($currentOrder) { + protected function renderListTemplate($currentOrder) + { return $this->render('variables', array('order' => $currentOrder)); } - protected function renderEditionTemplate() { + protected function renderEditionTemplate() + { return $this->render('variable-edit', array('variable_id' => $this->getRequest()->get('variable_id'))); } - protected function redirectToEditionTemplate() { + protected function redirectToEditionTemplate() + { $this->redirectToRoute( "admin.configuration.variables.update", array('variable_id' => $this->getRequest()->get('variable_id')) ); } - protected function redirectToListTemplate() { + protected function redirectToListTemplate() + { $this->redirectToRoute('admin.configuration.variables.default'); } @@ -188,4 +201,4 @@ class ConfigController extends AbstractCrudController $this->redirectToRoute('admin.configuration.variables.default'); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/ContentController.php b/core/lib/Thelia/Controller/Admin/ContentController.php index 10bfe07e0..11e23c209 100644 --- a/core/lib/Thelia/Controller/Admin/ContentController.php +++ b/core/lib/Thelia/Controller/Admin/ContentController.php @@ -32,7 +32,6 @@ use Thelia\Form\ContentCreationForm; use Thelia\Form\ContentModificationForm; use Thelia\Model\ContentQuery; - /** * Class ContentController * @package Thelia\Controller\Admin @@ -212,10 +211,10 @@ class ContentController extends AbstractCrudController { $folderId = $this->getRequest()->get('folder_id', null); - if(null === $folderId) { + if (null === $folderId) { $content = $this->getExistingObject(); - if($content) { + if ($content) { $folderId = $content->getDefaultFolderId(); } } @@ -275,7 +274,7 @@ class ContentController extends AbstractCrudController } /** - * @param \Thelia\Core\Event\Content\ContentUpdateEvent $updateEvent + * @param \Thelia\Core\Event\Content\ContentUpdateEvent $updateEvent * @return Response|void */ protected function performAdditionalUpdateAction($updateEvent) @@ -293,8 +292,8 @@ class ContentController extends AbstractCrudController /** * Put in this method post object delete processing if required. * - * @param \Thelia\Core\Event\Content\ContentDeleteEvent $deleteEvent the delete event - * @return Response a response, or null to continue normal processing + * @param \Thelia\Core\Event\Content\ContentDeleteEvent $deleteEvent the delete event + * @return Response a response, or null to continue normal processing */ protected function performAdditionalDeleteAction($deleteEvent) { @@ -344,4 +343,4 @@ class ContentController extends AbstractCrudController { return new ContentToggleVisibilityEvent($this->getExistingObject()); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/CountryController.php b/core/lib/Thelia/Controller/Admin/CountryController.php index fadca1e92..404c062a4 100644 --- a/core/lib/Thelia/Controller/Admin/CountryController.php +++ b/core/lib/Thelia/Controller/Admin/CountryController.php @@ -43,10 +43,10 @@ class CountryController extends BaseAdminController * @return mixed|\Symfony\Component\HttpFoundation\Response */ public function updateAction($country_id) - { + { return $this->render("country-edit", array( "country_id" => $country_id )); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/CouponController.php b/core/lib/Thelia/Controller/Admin/CouponController.php index 0ba2e961b..eaecacbda 100755 --- a/core/lib/Thelia/Controller/Admin/CouponController.php +++ b/core/lib/Thelia/Controller/Admin/CouponController.php @@ -31,7 +31,6 @@ use Thelia\Core\Event\Condition\ConditionCreateOrUpdateEvent; use Thelia\Core\Event\Coupon\CouponConsumeEvent; use Thelia\Core\Event\Coupon\CouponCreateOrUpdateEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Translation\Translator; use Thelia\Coupon\CouponManager; use Thelia\Coupon\ConditionCollection; use Thelia\Coupon\Type\CouponInterface; @@ -299,7 +298,6 @@ var_dump($coupon->getIsRemovingPostage());; ); } - /** * Manage Coupons read display * @@ -613,6 +611,4 @@ var_dump($coupon->getIsRemovingPostage());; // } // } - - } diff --git a/core/lib/Thelia/Controller/Admin/CurrencyController.php b/core/lib/Thelia/Controller/Admin/CurrencyController.php index 610de9474..6fd98983b 100644 --- a/core/lib/Thelia/Controller/Admin/CurrencyController.php +++ b/core/lib/Thelia/Controller/Admin/CurrencyController.php @@ -39,7 +39,8 @@ use Thelia\Core\Event\UpdatePositionEvent; */ class CurrencyController extends AbstractCrudController { - public function __construct() { + public function __construct() + { parent::__construct( 'currency', 'manual', @@ -58,15 +59,18 @@ class CurrencyController extends AbstractCrudController ); } - protected function getCreationForm() { + protected function getCreationForm() + { return new CurrencyCreationForm($this->getRequest()); } - protected function getUpdateForm() { + protected function getUpdateForm() + { return new CurrencyModificationForm($this->getRequest()); } - protected function getCreationEvent($formData) { + protected function getCreationEvent($formData) + { $createEvent = new CurrencyCreateEvent(); $createEvent @@ -80,7 +84,8 @@ class CurrencyController extends AbstractCrudController return $createEvent; } - protected function getUpdateEvent($formData) { + protected function getUpdateEvent($formData) + { $changeEvent = new CurrencyUpdateEvent($formData['id']); // Create and dispatch the change event @@ -95,8 +100,8 @@ class CurrencyController extends AbstractCrudController return $changeEvent; } - protected function createUpdatePositionEvent($positionChangeMode, $positionValue) { - + protected function createUpdatePositionEvent($positionChangeMode, $positionValue) + { return new UpdatePositionEvent( $this->getRequest()->get('currency_id', null), $positionChangeMode, @@ -104,16 +109,18 @@ class CurrencyController extends AbstractCrudController ); } - protected function getDeleteEvent() { + protected function getDeleteEvent() + { return new CurrencyDeleteEvent($this->getRequest()->get('currency_id')); } - protected function eventContainsObject($event) { + protected function eventContainsObject($event) + { return $event->hasCurrency(); } - protected function hydrateObjectForm($object) { - + protected function hydrateObjectForm($object) + { // Prepare the data that will hydrate the form $data = array( 'id' => $object->getId(), @@ -128,44 +135,51 @@ class CurrencyController extends AbstractCrudController return new CurrencyModificationForm($this->getRequest(), "form", $data); } - protected function getObjectFromEvent($event) { + protected function getObjectFromEvent($event) + { return $event->hasCurrency() ? $event->getCurrency() : null; } - protected function getExistingObject() { + protected function getExistingObject() + { return CurrencyQuery::create() ->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('currency_id')); } - protected function getObjectLabel($object) { + protected function getObjectLabel($object) + { return $object->getName(); } - protected function getObjectId($object) { + protected function getObjectId($object) + { return $object->getId(); } - protected function renderListTemplate($currentOrder) { + protected function renderListTemplate($currentOrder) + { return $this->render('currencies', array('order' => $currentOrder)); } - protected function renderEditionTemplate() { + protected function renderEditionTemplate() + { return $this->render('currency-edit', array('currency_id' => $this->getRequest()->get('currency_id'))); } - protected function redirectToEditionTemplate() { + protected function redirectToEditionTemplate() + { $this->redirectToRoute( "admin.configuration.currencies.update", array('currency_id' => $this->getRequest()->get('currency_id')) ); } - protected function redirectToListTemplate() { + protected function redirectToListTemplate() + { $this->redirectToRoute('admin.configuration.currencies.default'); } - /** * Update currencies rates */ diff --git a/core/lib/Thelia/Controller/Admin/CustomerController.php b/core/lib/Thelia/Controller/Admin/CustomerController.php index 39f124cb0..f559a5bb0 100644 --- a/core/lib/Thelia/Controller/Admin/CustomerController.php +++ b/core/lib/Thelia/Controller/Admin/CustomerController.php @@ -48,10 +48,9 @@ class CustomerController extends BaseAdminController public function viewAction($customer_id) { if (null !== $response = $this->checkAuth("admin.customer.view")) return $response; - - return $this->render("customer-edit", array( - "customer_id" => $customer_id - )); + return $this->render("customer-edit", array( + "customer_id" => $customer_id + )); } /** @@ -71,7 +70,7 @@ class CustomerController extends BaseAdminController try { $customer = CustomerQuery::create()->findPk($customer_id); - if(null === $customer) { + if (null === $customer) { throw new \InvalidArgumentException(sprintf("%d customer id does not exist", $customer_id)); } @@ -86,7 +85,7 @@ class CustomerController extends BaseAdminController $this->adminLogAppend(sprintf("Customer with Ref %s (ID %d) modified", $customerUpdated->getRef() , $customerUpdated->getId())); - if($this->getRequest()->get("save_mode") == "close") { + if ($this->getRequest()->get("save_mode") == "close") { $this->redirectToRoute("admin.customers"); } else { $this->redirectSuccess($customerModification); @@ -126,14 +125,14 @@ class CustomerController extends BaseAdminController $customer_id = $this->getRequest()->get("customer_id"); $customer = CustomerQuery::create()->findPk($customer_id); - if(null === $customer) { + if (null === $customer) { throw new \InvalidArgumentException(Translator::getInstance("The customer you want to delete does not exist")); } $event = new CustomerEvent($customer); $this->dispatch(TheliaEvents::CUSTOMER_DELETEACCOUNT, $event); - } catch(\Exception $e) { + } catch (\Exception $e) { $message = $e->getMessage(); } @@ -178,4 +177,4 @@ class CustomerController extends BaseAdminController return $customerCreateEvent; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/FeatureAvController.php b/core/lib/Thelia/Controller/Admin/FeatureAvController.php index d768f8d18..e8684ef04 100644 --- a/core/lib/Thelia/Controller/Admin/FeatureAvController.php +++ b/core/lib/Thelia/Controller/Admin/FeatureAvController.php @@ -193,4 +193,4 @@ class FeatureAvController extends AbstractCrudController $this->getViewArguments() ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/FeatureController.php b/core/lib/Thelia/Controller/Admin/FeatureController.php index 9e2e581e4..a8fde8880 100644 --- a/core/lib/Thelia/Controller/Admin/FeatureController.php +++ b/core/lib/Thelia/Controller/Admin/FeatureController.php @@ -113,7 +113,7 @@ class FeatureController extends AbstractCrudController if ($attr_values !== null) { - foreach($attr_values as $id => $value) { + foreach ($attr_values as $id => $value) { $event = new FeatureAvUpdateEvent($id); @@ -168,7 +168,7 @@ class FeatureController extends AbstractCrudController $attr_array = array(); - foreach($attr_av_list as $attr_av) { + foreach ($attr_av_list as $attr_av) { $attr_array[$attr_av->getId()] = $attr_av->getTitle(); } @@ -262,8 +262,7 @@ class FeatureController extends AbstractCrudController $this->dispatch($eventType, $event); } - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -286,4 +285,4 @@ class FeatureController extends AbstractCrudController { return $this->addRemoveFromAllTemplates(TheliaEvents::FEATURE_ADD_TO_ALL_TEMPLATES); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/FileController.php b/core/lib/Thelia/Controller/Admin/FileController.php index 1ef048486..e99b857f7 100755 --- a/core/lib/Thelia/Controller/Admin/FileController.php +++ b/core/lib/Thelia/Controller/Admin/FileController.php @@ -25,15 +25,12 @@ namespace Thelia\Controller\Admin; use Propel\Runtime\Exception\PropelException; use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Routing\Router; use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent; use Thelia\Core\Event\Document\DocumentDeleteEvent; use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent; use Thelia\Core\Event\Image\ImageDeleteEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Translation\Translator; use Thelia\Form\Exception\FormValidationException; use Thelia\Log\Tlog; use Thelia\Model\CategoryDocument; @@ -62,7 +59,6 @@ use Thelia\Tools\Rest\ResponseRest; class FileController extends BaseAdminController { - /** * Manage how a image collection has to be saved * @@ -126,14 +122,12 @@ class FileController extends BaseAdminController $imageCreateOrUpdateEvent->setUploadedFile($fileBeingUploaded); $imageCreateOrUpdateEvent->setParentName($parentModel->getTitle()); - // Dispatch Event to the Action $this->dispatch( TheliaEvents::IMAGE_SAVE, $imageCreateOrUpdateEvent ); - return new ResponseRest(array('status' => true, 'message' => '')); } } @@ -192,14 +186,12 @@ class FileController extends BaseAdminController $documentCreateOrUpdateEvent->setUploadedFile($fileBeingUploaded); $documentCreateOrUpdateEvent->setParentName($parentModel->getTitle()); - // Dispatch Event to the Action $this->dispatch( TheliaEvents::DOCUMENT_SAVE, $documentCreateOrUpdateEvent ); - return new ResponseRest(array('status' => true, 'message' => '')); } } @@ -676,5 +668,4 @@ class FileController extends BaseAdminController return $documentCreateEvent; } - } diff --git a/core/lib/Thelia/Controller/Admin/FolderController.php b/core/lib/Thelia/Controller/Admin/FolderController.php index 360d97357..24e2659d9 100644 --- a/core/lib/Thelia/Controller/Admin/FolderController.php +++ b/core/lib/Thelia/Controller/Admin/FolderController.php @@ -81,8 +81,8 @@ class FolderController extends AbstractCrudController * * @param \Thelia\Model\Folder $object */ - protected function hydrateObjectForm($object) { - + protected function hydrateObjectForm($object) + { // Prepare the data that will hydrate the form $data = array( 'id' => $object->getId(), @@ -162,8 +162,8 @@ class FolderController extends AbstractCrudController * @param $positionValue * @return UpdatePositionEvent|void */ - protected function createUpdatePositionEvent($positionChangeMode, $positionValue) { - + protected function createUpdatePositionEvent($positionChangeMode, $positionValue) + { return new UpdatePositionEvent( $this->getRequest()->get('folder_id', null), $positionChangeMode, @@ -196,7 +196,8 @@ class FolderController extends AbstractCrudController /** * Load an existing object from the database */ - protected function getExistingObject() { + protected function getExistingObject() + { return FolderQuery::create() ->joinWithI18n($this->getCurrentEditionLocale()) ->findOneById($this->getRequest()->get('folder_id', 0)); @@ -207,7 +208,8 @@ class FolderController extends AbstractCrudController * * @param unknown $object */ - protected function getObjectLabel($object) { + protected function getObjectLabel($object) + { return $object->getTitle(); } @@ -226,8 +228,8 @@ class FolderController extends AbstractCrudController * * @param unknown $currentOrder, if any, null otherwise. */ - protected function renderListTemplate($currentOrder) { - + protected function renderListTemplate($currentOrder) + { // Get content order $content_order = $this->getListOrderFromSession('content', 'content_order', 'manual'); @@ -239,12 +241,11 @@ class FolderController extends AbstractCrudController )); } - /** * Render the edition template */ - protected function renderEditionTemplate() { - + protected function renderEditionTemplate() + { return $this->render('folder-edit', $this->getEditionArguments()); } @@ -257,7 +258,7 @@ class FolderController extends AbstractCrudController } /** - * @param \Thelia\Core\Event\Folder\FolderUpdateEvent $updateEvent + * @param \Thelia\Core\Event\Folder\FolderUpdateEvent $updateEvent * @return Response|void */ protected function performAdditionalUpdateAction($updateEvent) @@ -275,8 +276,8 @@ class FolderController extends AbstractCrudController /** * Put in this method post object delete processing if required. * - * @param \Thelia\Core\Event\Folder\FolderDeleteEvent $deleteEvent the delete event - * @return Response a response, or null to continue normal processing + * @param \Thelia\Core\Event\Folder\FolderDeleteEvent $deleteEvent the delete event + * @return Response a response, or null to continue normal processing */ protected function performAdditionalDeleteAction($deleteEvent) { @@ -325,4 +326,4 @@ class FolderController extends AbstractCrudController array('parent' => $this->getRequest()->get('parent', 0)) ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/ModuleController.php b/core/lib/Thelia/Controller/Admin/ModuleController.php index fe794abf9..03691c069 100644 --- a/core/lib/Thelia/Controller/Admin/ModuleController.php +++ b/core/lib/Thelia/Controller/Admin/ModuleController.php @@ -35,12 +35,11 @@ class ModuleController extends BaseAdminController if (null !== $response = $this->checkAuth("admin.module.view")) return $response; return $this->render("modules", array("display_module" => 20)); } - + public function updateAction($module_id) { - - return $this->render("module-edit", array( - "module_id" => $module_id - )); + return $this->render("module-edit", array( + "module_id" => $module_id + )); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/OrderController.php b/core/lib/Thelia/Controller/Admin/OrderController.php index 1c6d2711a..77df4f9b3 100644 --- a/core/lib/Thelia/Controller/Admin/OrderController.php +++ b/core/lib/Thelia/Controller/Admin/OrderController.php @@ -26,7 +26,6 @@ namespace Thelia\Controller\Admin; use Thelia\Core\Event\Order\OrderAddressEvent; use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Translation\Translator; use Thelia\Form\OrderUpdateAddress; use Thelia\Model\Base\OrderAddressQuery; use Thelia\Model\OrderQuery; @@ -48,10 +47,9 @@ class OrderController extends BaseAdminController public function viewAction($order_id) { - - return $this->render("order-edit", array( - "order_id" => $order_id - )); + return $this->render("order-edit", array( + "order_id" => $order_id + )); } public function updateStatus($order_id = null) @@ -61,7 +59,7 @@ class OrderController extends BaseAdminController $message = null; try { - if($order_id !== null) { + if ($order_id !== null) { $order_id = $order_id; } else { $order_id = $this->getRequest()->get("order_id"); @@ -72,10 +70,10 @@ class OrderController extends BaseAdminController $statusId = $this->getRequest()->request->get("status_id"); $status = OrderStatusQuery::create()->findPk($statusId); - if(null === $order) { + if (null === $order) { throw new \InvalidArgumentException("The order you want to update status does not exist"); } - if(null === $status) { + if (null === $status) { throw new \InvalidArgumentException("The status you want to set to the order does not exist"); } @@ -83,7 +81,7 @@ class OrderController extends BaseAdminController $event->setStatus($statusId); $this->dispatch(TheliaEvents::ORDER_UPDATE_STATUS, $event); - } catch(\Exception $e) { + } catch (\Exception $e) { $message = $e->getMessage(); } @@ -95,7 +93,7 @@ class OrderController extends BaseAdminController $browsedPage = $this->getRequest()->get("order_page"); - if($browsedPage) { + if ($browsedPage) { $params["order_page"] = $browsedPage; $this->redirectToRoute("admin.order.list", $params); } else { @@ -116,7 +114,7 @@ class OrderController extends BaseAdminController $deliveryRef = $this->getRequest()->get("delivery_ref"); - if(null === $order) { + if (null === $order) { throw new \InvalidArgumentException("The order you want to update status does not exist"); } @@ -124,7 +122,7 @@ class OrderController extends BaseAdminController $event->setDeliveryRef($deliveryRef); $this->dispatch(TheliaEvents::ORDER_UPDATE_DELIVERY_REF, $event); - } catch(\Exception $e) { + } catch (\Exception $e) { $message = $e->getMessage(); } @@ -151,7 +149,7 @@ class OrderController extends BaseAdminController try { $order = OrderQuery::create()->findPk($order_id); - if(null === $order) { + if (null === $order) { throw new \InvalidArgumentException("The order you want to update does not exist"); } @@ -159,7 +157,7 @@ class OrderController extends BaseAdminController $orderAddress = OrderAddressQuery::create()->findPk($form->get("id")->getData()); - if($orderAddress->getId() !== $order->getInvoiceOrderAddressId() && $orderAddress->getId() !== $order->getDeliveryOrderAddressId()) { + if ($orderAddress->getId() !== $order->getInvoiceOrderAddressId() && $orderAddress->getId() !== $order->getDeliveryOrderAddressId()) { throw new \InvalidArgumentException("The order address you want to update does not belong to the current order not exist"); } @@ -180,7 +178,7 @@ class OrderController extends BaseAdminController $event->setOrder($order); $this->dispatch(TheliaEvents::ORDER_UPDATE_ADDRESS, $event); - } catch(\Exception $e) { + } catch (\Exception $e) { $message = $e->getMessage(); } @@ -195,4 +193,4 @@ class OrderController extends BaseAdminController $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute("admin.order.update.view", $params))); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/ProductController.php b/core/lib/Thelia/Controller/Admin/ProductController.php index c400a28a2..afda4b274 100644 --- a/core/lib/Thelia/Controller/Admin/ProductController.php +++ b/core/lib/Thelia/Controller/Admin/ProductController.php @@ -34,7 +34,6 @@ use Thelia\Core\Event\UpdatePositionEvent; use Thelia\Core\Event\Product\ProductToggleVisibilityEvent; use Thelia\Core\Event\Product\ProductDeleteContentEvent; use Thelia\Core\Event\Product\ProductAddContentEvent; -use Thelia\Model\ProductAssociatedContent; use Thelia\Model\FolderQuery; use Thelia\Model\ContentQuery; use Propel\Runtime\ActiveQuery\Criteria; @@ -76,8 +75,8 @@ class ProductController extends AbstractCrudController /** * Attributes ajax tab loading */ - public function loadAttributesAjaxTabAction() { - + public function loadAttributesAjaxTabAction() + { return $this->render( 'ajax/product-attributes-tab', array( @@ -89,8 +88,8 @@ class ProductController extends AbstractCrudController /** * Related information ajax tab loading */ - public function loadRelatedAjaxTabAction() { - + public function loadRelatedAjaxTabAction() + { return $this->render( 'ajax/product-related-tab', array( @@ -229,7 +228,8 @@ class ProductController extends AbstractCrudController ); } - protected function getCategoryId() { + protected function getCategoryId() + { // Trouver le category_id, soit depuis la reques, souit depuis le produit courant $category_id = $this->getRequest()->get('category_id', null); @@ -340,7 +340,7 @@ class ProductController extends AbstractCrudController ; if ($list !== null) { - foreach($list as $item) { + foreach ($list as $item) { $result[] = array('id' => $item->getId(), 'title' => $item->getTitle()); } } @@ -366,8 +366,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_ADD_CONTENT, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -393,8 +392,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_REMOVE_CONTENT, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -403,7 +401,6 @@ class ProductController extends AbstractCrudController $this->redirectToEditionTemplate(); } - // -- Accessories management ---------------------------------------------- public function getAvailableAccessoriesAction($productId, $categoryId) @@ -422,7 +419,7 @@ class ProductController extends AbstractCrudController ; if ($list !== null) { - foreach($list as $item) { + foreach ($list as $item) { $result[] = array('id' => $item->getId(), 'title' => $item->getTitle()); } } @@ -447,8 +444,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_ADD_ACCESSORY, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -473,8 +469,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_REMOVE_ACCESSORY, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -514,7 +509,8 @@ class ProductController extends AbstractCrudController * * @param unknown $productId */ - public function setProductTemplateAction($productId) { + public function setProductTemplateAction($productId) + { // Check current user authorization if (null !== $response = $this->checkAuth('admin.products.update')) return $response; @@ -536,8 +532,8 @@ class ProductController extends AbstractCrudController /** * Update product attributes and features */ - public function updateAttributesAndFeaturesAction($productId) { - + public function updateAttributesAndFeaturesAction($productId) + { $product = ProductQuery::create()->findPk($productId); if ($product != null) { @@ -556,7 +552,7 @@ class ProductController extends AbstractCrudController // Update all features values, starting with feature av. values $featureValues = $this->getRequest()->get('feature_value', array()); - foreach($featureValues as $featureId => $featureValueList) { + foreach ($featureValues as $featureId => $featureValueList) { // Delete all features av. for this feature. $event = new FeatureProductDeleteEvent($productId, $featureId); @@ -564,7 +560,7 @@ class ProductController extends AbstractCrudController $this->dispatch(TheliaEvents::PRODUCT_FEATURE_DELETE_VALUE, $event); // Add then all selected values - foreach($featureValueList as $featureValue) { + foreach ($featureValueList as $featureValue) { $event = new FeatureProductUpdateEvent($productId, $featureId, $featureValue); $this->dispatch(TheliaEvents::PRODUCT_FEATURE_UPDATE_VALUE, $event); @@ -576,7 +572,7 @@ class ProductController extends AbstractCrudController // Update then features text values $featureTextValues = $this->getRequest()->get('feature_text_value', array()); - foreach($featureTextValues as $featureId => $featureValue) { + foreach ($featureTextValues as $featureId => $featureValue) { // considere empty text as empty feature value (e.g., we will delete it) if (empty($featureValue)) continue; @@ -589,7 +585,7 @@ class ProductController extends AbstractCrudController } // Delete features which don't have any values - foreach($allFeatures as $feature) { + foreach ($allFeatures as $feature) { if (! in_array($feature->getId(), $updatedFeatures)) { $event = new FeatureProductDeleteEvent($productId, $feature->getId()); @@ -610,8 +606,8 @@ class ProductController extends AbstractCrudController $this->redirectToListTemplate(); } - public function addAdditionalCategoryAction() { - + public function addAdditionalCategoryAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.products.update")) return $response; @@ -626,8 +622,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_ADD_CATEGORY, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -636,8 +631,8 @@ class ProductController extends AbstractCrudController $this->redirectToEditionTemplate(); } - public function deleteAdditionalCategoryAction() { - + public function deleteAdditionalCategoryAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.products.update")) return $response; @@ -652,8 +647,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_REMOVE_CATEGORY, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -664,8 +658,8 @@ class ProductController extends AbstractCrudController // -- Product combination management --------------------------------------- - public function getAttributeValuesAction($productId, $attributeId) { - + public function getAttributeValuesAction($productId, $attributeId) + { $result = array(); // Get attribute for this product @@ -680,7 +674,7 @@ class ProductController extends AbstractCrudController ; if ($values !== null) { - foreach($values as $value) { + foreach ($values as $value) { $result[] = array('id' => $value->getId(), 'title' => $value->getTitle()); } } @@ -689,8 +683,8 @@ class ProductController extends AbstractCrudController return $this->jsonResponse(json_encode($result)); } - public function addAttributeValueToCombinationAction($productId, $attributeAvId, $combination) { - + public function addAttributeValueToCombinationAction($productId, $attributeAvId, $combination) + { $result = array(); // Get attribute for this product @@ -734,8 +728,8 @@ class ProductController extends AbstractCrudController /** * A a new combination to a product */ - public function addCombinationAction() { - + public function addCombinationAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.products.update")) return $response; @@ -747,8 +741,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_ADD_COMBINATION, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -760,8 +753,8 @@ class ProductController extends AbstractCrudController /** * A a new combination to a product */ - public function deleteCombinationAction() { - + public function deleteCombinationAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.products.update")) return $response; @@ -772,8 +765,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_DELETE_COMBINATION, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } diff --git a/core/lib/Thelia/Controller/Admin/SessionController.php b/core/lib/Thelia/Controller/Admin/SessionController.php index 120a28b26..6d8d14416 100755 --- a/core/lib/Thelia/Controller/Admin/SessionController.php +++ b/core/lib/Thelia/Controller/Admin/SessionController.php @@ -31,9 +31,7 @@ use Thelia\Tools\URL; use Thelia\Tools\Redirect; use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Security\Authentication\AdminTokenAuthenticator; -use Thelia\Core\Security\UserProvider\TokenProvider; use Symfony\Component\HttpFoundation\Cookie; -use Thelia\Core\Security\UserProvider\CookieTokenProvider; use Thelia\Core\Security\Exception\TokenAuthenticationException; class SessionController extends BaseAdminController @@ -59,8 +57,7 @@ class SessionController extends BaseAdminController // Render the home page return $this->render("home"); - } - catch (TokenAuthenticationException $ex) { + } catch (TokenAuthenticationException $ex) { $this->adminLogAppend("Token based authentication failed."); // Clear the cookie diff --git a/core/lib/Thelia/Controller/Admin/ShippingConfigurationController.php b/core/lib/Thelia/Controller/Admin/ShippingConfigurationController.php index 71aa0ba2f..92b73a83e 100644 --- a/core/lib/Thelia/Controller/Admin/ShippingConfigurationController.php +++ b/core/lib/Thelia/Controller/Admin/ShippingConfigurationController.php @@ -35,12 +35,11 @@ class ShippingConfigurationController extends BaseAdminController if (null !== $response = $this->checkAuth("admin.shipping-configuration.view")) return $response; return $this->render("shipping-configuration", array("display_shipping_configuration" => 20)); } - + public function updateAction($shipping_configuration_id) { - return $this->render("shipping-configuration-edit", array( "shipping_configuration_id" => $shipping_configuration_id )); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/ShippingZoneController.php b/core/lib/Thelia/Controller/Admin/ShippingZoneController.php index ee34d11bd..0084c861b 100644 --- a/core/lib/Thelia/Controller/Admin/ShippingZoneController.php +++ b/core/lib/Thelia/Controller/Admin/ShippingZoneController.php @@ -35,12 +35,11 @@ class ShippingZoneController extends BaseAdminController if (null !== $response = $this->checkAuth("admin.shipping-zones.view")) return $response; return $this->render("shipping-zones", array("display_shipping_zone" => 20)); } - + public function updateAction($shipping_zones_id) { - - return $this->render("shipping-zones-edit", array( - "shipping_zones_id" => $shipping_zones_id - )); + return $this->render("shipping-zones-edit", array( + "shipping_zones_id" => $shipping_zones_id + )); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/TemplateController.php b/core/lib/Thelia/Controller/Admin/TemplateController.php index 50f25252f..bdeac9fd2 100644 --- a/core/lib/Thelia/Controller/Admin/TemplateController.php +++ b/core/lib/Thelia/Controller/Admin/TemplateController.php @@ -30,10 +30,6 @@ use Thelia\Core\Event\Template\TemplateCreateEvent; use Thelia\Model\TemplateQuery; use Thelia\Form\TemplateModificationForm; use Thelia\Form\TemplateCreationForm; -use Thelia\Core\Event\UpdatePositionEvent; -use Thelia\Model\TemplateAv; -use Thelia\Model\TemplateAvQuery; -use Thelia\Core\Event\Template\TemplateEvent; use Thelia\Core\Event\Template\TemplateDeleteAttributeEvent; use Thelia\Core\Event\Template\TemplateAddAttributeEvent; use Thelia\Core\Event\Template\TemplateAddFeatureEvent; @@ -41,7 +37,6 @@ use Thelia\Core\Event\Template\TemplateDeleteFeatureEvent; use Thelia\Model\FeatureTemplateQuery; use Thelia\Model\AttributeTemplateQuery; - /** * Manages product templates * @@ -102,7 +97,6 @@ class TemplateController extends AbstractCrudController ; // Add feature and attributes list - return $changeEvent; } @@ -199,22 +193,24 @@ class TemplateController extends AbstractCrudController return null; } - public function getAjaxFeaturesAction() { + public function getAjaxFeaturesAction() + { return $this->render( 'ajax/template-feature-list', array('template_id' => $this->getRequest()->get('template_id')) ); } - public function getAjaxAttributesAction() { + public function getAjaxAttributesAction() + { return $this->render( 'ajax/template-attribute-list', array('template_id' => $this->getRequest()->get('template_id')) ); } - public function addAttributeAction() { - + public function addAttributeAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.configuration.template.attribute.add")) return $response; @@ -237,8 +233,8 @@ class TemplateController extends AbstractCrudController $this->redirectToEditionTemplate(); } - public function deleteAttributeAction() { - + public function deleteAttributeAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.configuration.template.attribute.delete")) return $response; @@ -257,8 +253,8 @@ class TemplateController extends AbstractCrudController $this->redirectToEditionTemplate(); } - public function updateAttributePositionAction() { - + public function updateAttributePositionAction() + { // Find attribute_template $attributeTemplate = AttributeTemplateQuery::create() ->filterByTemplateId($this->getRequest()->get('template_id', null)) @@ -272,8 +268,8 @@ class TemplateController extends AbstractCrudController ); } - public function addFeatureAction() { - + public function addFeatureAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.configuration.template.feature.add")) return $response; @@ -296,8 +292,8 @@ class TemplateController extends AbstractCrudController $this->redirectToEditionTemplate(); } - public function deleteFeatureAction() { - + public function deleteFeatureAction() + { // Check current user authorization if (null !== $response = $this->checkAuth("admin.configuration.template.feature.delete")) return $response; @@ -316,8 +312,8 @@ class TemplateController extends AbstractCrudController $this->redirectToEditionTemplate(); } - public function updateFeaturePositionAction() { - + public function updateFeaturePositionAction() + { // Find feature_template $featureTemplate = FeatureTemplateQuery::create() ->filterByTemplateId($this->getRequest()->get('template_id', null)) @@ -330,4 +326,4 @@ class TemplateController extends AbstractCrudController TheliaEvents::TEMPLATE_CHANGE_FEATURE_POSITION ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php index 8ba0cb038..51d2015ea 100755 --- a/core/lib/Thelia/Controller/BaseController.php +++ b/core/lib/Thelia/Controller/BaseController.php @@ -286,7 +286,7 @@ class BaseController extends ContainerAware */ protected function checkXmlHttpRequest() { - if(false === $this->getRequest()->isXmlHttpRequest() && false === $this->isDebug()) { + if (false === $this->getRequest()->isXmlHttpRequest() && false === $this->isDebug()) { $this->accessDenied(); } } @@ -300,6 +300,7 @@ class BaseController extends ContainerAware public function getMailer() { $mailer = $this->container->get('mailer'); + return $mailer->getSwiftMailer(); } } diff --git a/core/lib/Thelia/Controller/Front/AddressController.php b/core/lib/Thelia/Controller/Front/AddressController.php index 9c99146cd..94d0f78d7 100644 --- a/core/lib/Thelia/Controller/Front/AddressController.php +++ b/core/lib/Thelia/Controller/Front/AddressController.php @@ -30,7 +30,6 @@ use Thelia\Form\AddressUpdateForm; use Thelia\Form\Exception\FormValidationException; use Thelia\Model\AddressQuery; use Thelia\Model\Customer; -use Thelia\Tools\URL; /** * Class AddressController @@ -51,10 +50,8 @@ class AddressController extends BaseFrontController $this->checkAuth(); $this->checkXmlHttpRequest(); - } - /** * Create controller. * Check if customer is logged in @@ -103,7 +100,7 @@ class AddressController extends BaseFrontController $customer = $this->getSecurityContext()->getCustomerUser(); $address = AddressQuery::create()->findPk($address_id); - if(!$address || $customer->getId() != $address->getCustomerId()) { + if (!$address || $customer->getId() != $address->getCustomerId()) { $this->redirectToRoute("home"); } @@ -117,7 +114,6 @@ class AddressController extends BaseFrontController $addressUpdate = new AddressUpdateForm($request); - try { $customer = $this->getSecurityContext()->getCustomerUser(); @@ -164,7 +160,7 @@ class AddressController extends BaseFrontController $customer = $this->getSecurityContext()->getCustomerUser(); $address = AddressQuery::create()->findPk($address_id); - if(!$address || $customer->getId() != $address->getCustomerId()) { + if (!$address || $customer->getId() != $address->getCustomerId()) { $this->redirectToRoute("home"); } diff --git a/core/lib/Thelia/Controller/Front/BaseFrontController.php b/core/lib/Thelia/Controller/Front/BaseFrontController.php index 152c2c10e..fadf65795 100755 --- a/core/lib/Thelia/Controller/Front/BaseFrontController.php +++ b/core/lib/Thelia/Controller/Front/BaseFrontController.php @@ -55,7 +55,7 @@ class BaseFrontController extends BaseController public function checkAuth() { - if($this->getSecurityContext()->hasCustomerUser() === false) { + if ($this->getSecurityContext()->hasCustomerUser() === false) { $this->redirectToRoute("customer.login.view"); } } @@ -63,7 +63,7 @@ class BaseFrontController extends BaseController protected function checkCartNotEmpty() { $cart = $this->getSession()->getCart(); - if($cart===null || $cart->countCartItems() == 0) { + if ($cart===null || $cart->countCartItems() == 0) { $this->redirectToRoute("cart.view"); } } @@ -71,7 +71,7 @@ class BaseFrontController extends BaseController protected function checkValidDelivery() { $order = $this->getSession()->getOrder(); - if(null === $order || null === $order->chosenDeliveryAddress || null === $order->getDeliveryModuleId() || null === AddressQuery::create()->findPk($order->chosenDeliveryAddress) || null === ModuleQuery::create()->findPk($order->getDeliveryModuleId())) { + if (null === $order || null === $order->chosenDeliveryAddress || null === $order->getDeliveryModuleId() || null === AddressQuery::create()->findPk($order->chosenDeliveryAddress) || null === ModuleQuery::create()->findPk($order->getDeliveryModuleId())) { $this->redirectToRoute("order.delivery"); } } @@ -79,7 +79,7 @@ class BaseFrontController extends BaseController protected function checkValidInvoice() { $order = $this->getSession()->getOrder(); - if(null === $order || null === $order->chosenInvoiceAddress || null === $order->getPaymentModuleId() || null === AddressQuery::create()->findPk($order->chosenInvoiceAddress) || null === ModuleQuery::create()->findPk($order->getPaymentModuleId())) { + if (null === $order || null === $order->chosenInvoiceAddress || null === $order->getPaymentModuleId() || null === AddressQuery::create()->findPk($order->chosenInvoiceAddress) || null === ModuleQuery::create()->findPk($order->getPaymentModuleId())) { $this->redirectToRoute("order.invoice"); } } diff --git a/core/lib/Thelia/Controller/Front/CustomerController.php b/core/lib/Thelia/Controller/Front/CustomerController.php index 9235a6c18..f322d3fe1 100755 --- a/core/lib/Thelia/Controller/Front/CustomerController.php +++ b/core/lib/Thelia/Controller/Front/CustomerController.php @@ -104,7 +104,7 @@ class CustomerController extends BaseFrontController $this->processLogin($customerCreateEvent->getCustomer()); $cart = $this->getCart($this->getRequest()); - if($cart->getCartItems()->count() > 0) { + if ($cart->getCartItems()->count() > 0) { $this->redirectToRoute("cart.view"); } else { $this->redirectSuccess($customerCreation); diff --git a/core/lib/Thelia/Controller/Front/OrderController.php b/core/lib/Thelia/Controller/Front/OrderController.php index 767693fce..968597b8a 100755 --- a/core/lib/Thelia/Controller/Front/OrderController.php +++ b/core/lib/Thelia/Controller/Front/OrderController.php @@ -34,7 +34,6 @@ use Thelia\Log\Tlog; use Thelia\Model\AddressQuery; use Thelia\Model\AreaDeliveryModuleQuery; use Thelia\Model\Base\OrderQuery; -use Thelia\Model\CountryQuery; use Thelia\Model\ModuleQuery; use Thelia\Model\Order; use Thelia\Tools\URL; @@ -69,7 +68,7 @@ class OrderController extends BaseFrontController /* check that the delivery address belongs to the current customer */ $deliveryAddress = AddressQuery::create()->findPk($deliveryAddressId); - if($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) { + if ($deliveryAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) { throw new \Exception("Delivery address does not belong to the current customer"); } @@ -139,7 +138,7 @@ class OrderController extends BaseFrontController /* check that the invoice address belongs to the current customer */ $invoiceAddress = AddressQuery::create()->findPk($invoiceAddressId); - if($invoiceAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) { + if ($invoiceAddress->getCustomerId() !== $this->getSecurityContext()->getCustomerUser()->getId()) { throw new \Exception("Invoice address does not belong to the current customer"); } @@ -193,7 +192,7 @@ class OrderController extends BaseFrontController $placedOrder = $orderEvent->getPlacedOrder(); - if(null !== $placedOrder && null !== $placedOrder->getId()) { + if (null !== $placedOrder && null !== $placedOrder->getId()) { /* order has been placed */ $this->redirect(URL::getInstance()->absoluteUrl($this->getRoute('order.placed', array('order_id' => $orderEvent->getPlacedOrder()->getId())))); } else { @@ -209,13 +208,13 @@ class OrderController extends BaseFrontController $this->getRequest()->attributes->get('order_id') ); - if(null === $placedOrder) { + if (null === $placedOrder) { throw new TheliaProcessException("No placed order", TheliaProcessException::NO_PLACED_ORDER, $placedOrder); } $customer = $this->getSecurityContext()->getCustomerUser(); - if(null === $customer || $placedOrder->getCustomerId() !== $customer->getId()) { + if (null === $customer || $placedOrder->getCustomerId() !== $customer->getId()) { throw new TheliaProcessException("Received placed order id does not belong to the current customer", TheliaProcessException::PLACED_ORDER_ID_BAD_CURRENT_CUSTOMER, $placedOrder); } diff --git a/core/lib/Thelia/Core/Event/Address/AddressCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Address/AddressCreateOrUpdateEvent.php index ecc61076e..05fc909d2 100644 --- a/core/lib/Thelia/Core/Event/Address/AddressCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Address/AddressCreateOrUpdateEvent.php @@ -244,8 +244,6 @@ class AddressCreateOrUpdateEvent extends ActionEvent return $this->isDefault; } - - /** * @param \Thelia\Model\Customer $customer */ diff --git a/core/lib/Thelia/Core/Event/Content/ContentCreateEvent.php b/core/lib/Thelia/Core/Event/Content/ContentCreateEvent.php index 5e2e7f0ea..7763fd359 100644 --- a/core/lib/Thelia/Core/Event/Content/ContentCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Content/ContentCreateEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Content; - /** * Class ContentCreateEvent * @package Thelia\Core\Event\Content @@ -76,9 +75,6 @@ class ContentCreateEvent extends ContentEvent return $this->default_folder; } - - - /** * @param mixed $visible * @@ -119,6 +115,4 @@ class ContentCreateEvent extends ContentEvent return $this->title; } - - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Content/ContentDeleteEvent.php b/core/lib/Thelia/Core/Event/Content/ContentDeleteEvent.php index 3b5e5423b..8ad5b1c6f 100644 --- a/core/lib/Thelia/Core/Event/Content/ContentDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Content/ContentDeleteEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Content; - /** * Class ContentDeleteEvent * @package Thelia\Core\Event\Content @@ -35,7 +34,7 @@ class ContentDeleteEvent extends ContentEvent protected $folder_id; - function __construct($content_id) + public function __construct($content_id) { $this->content_id = $content_id; } @@ -70,5 +69,4 @@ class ContentDeleteEvent extends ContentEvent return $this->folder_id; } - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Content/ContentEvent.php b/core/lib/Thelia/Core/Event/Content/ContentEvent.php index 0949348e3..aebda8d28 100644 --- a/core/lib/Thelia/Core/Event/Content/ContentEvent.php +++ b/core/lib/Thelia/Core/Event/Content/ContentEvent.php @@ -25,7 +25,6 @@ namespace Thelia\Core\Event\Content; use Thelia\Core\Event\ActionEvent; use Thelia\Model\Content; - /** * Class ContentEvent * @package Thelia\Core\Event\Content @@ -38,7 +37,7 @@ class ContentEvent extends ActionEvent */ protected $content; - function __construct(Content $content = null) + public function __construct(Content $content = null) { $this->content = $content; } @@ -70,4 +69,4 @@ class ContentEvent extends ActionEvent { return null !== $this->content; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Content/ContentToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/Content/ContentToggleVisibilityEvent.php index 55176635c..b2b7e46e9 100644 --- a/core/lib/Thelia/Core/Event/Content/ContentToggleVisibilityEvent.php +++ b/core/lib/Thelia/Core/Event/Content/ContentToggleVisibilityEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Content; - /** * Class ContentToggleVisibilityEvent * @package Thelia\Core\Event\Content @@ -32,4 +31,4 @@ namespace Thelia\Core\Event\Content; class ContentToggleVisibilityEvent extends ContentEvent { -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php b/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php index f7c75a01f..fb5bdfb5e 100644 --- a/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Content/ContentUpdateEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Content; - /** * Class ContentUpdateEvent * @package Thelia\Core\Event\Content @@ -39,7 +38,7 @@ class ContentUpdateEvent extends ContentCreateEvent protected $url; - function __construct($content_id) + public function __construct($content_id) { $this->content_id = $content_id; } @@ -144,7 +143,4 @@ class ContentUpdateEvent extends ContentCreateEvent return $this->url; } - - - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php index 229ec66b5..2c59c2899 100755 --- a/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Customer/CustomerCreateOrUpdateEvent.php @@ -59,7 +59,7 @@ class CustomerCreateOrUpdateEvent extends ActionEvent protected $customer; /** - * @param int $title the title customer id + * @param int $title the title customer id * @param string $firstname * @param string $lastname * @param string $address1 @@ -69,13 +69,13 @@ class CustomerCreateOrUpdateEvent extends ActionEvent * @param string $cellphone * @param string $zipcode * @param string $city - * @param int $country the country id + * @param int $country the country id * @param string $email * @param string $password plain password, don't put hash password, it will hashes again * @param $lang - * @param int $reseller if customer is a reseller - * @param int $sponsor customer's id sponsor - * @param float $discount + * @param int $reseller if customer is a reseller + * @param int $sponsor customer's id sponsor + * @param float $discount * @param string $company */ public function __construct($title, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $city, $country, $email, $password, $lang, $reseller, $sponsor, $discount, $company) diff --git a/core/lib/Thelia/Core/Event/Document/DocumentCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Document/DocumentCreateOrUpdateEvent.php index f2387c8f0..74deeacc1 100755 --- a/core/lib/Thelia/Core/Event/Document/DocumentCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Document/DocumentCreateOrUpdateEvent.php @@ -66,7 +66,7 @@ class DocumentCreateOrUpdateEvent extends ActionEvent * * @param string $documentType Document type * ex : FileManager::TYPE_CATEGORY - * @param int $parentId Document parent id + * @param int $parentId Document parent id */ public function __construct($documentType, $parentId) { @@ -214,5 +214,4 @@ class DocumentCreateOrUpdateEvent extends ActionEvent return $this->oldModelDocument; } - } diff --git a/core/lib/Thelia/Core/Event/Document/DocumentDeleteEvent.php b/core/lib/Thelia/Core/Event/Document/DocumentDeleteEvent.php index 68da5c0c1..28a51a208 100755 --- a/core/lib/Thelia/Core/Event/Document/DocumentDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Document/DocumentDeleteEvent.php @@ -109,5 +109,4 @@ class DocumentDeleteEvent extends ActionEvent return $this->documentToDelete; } - } diff --git a/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductEvent.php b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductEvent.php index 194469673..aef4b25f5 100644 --- a/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductEvent.php +++ b/core/lib/Thelia/Core/Event/FeatureProduct/FeatureProductEvent.php @@ -50,4 +50,4 @@ class FeatureProductEvent extends ActionEvent return $this; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Folder/FolderCreateEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderCreateEvent.php index a788373c8..162d6c896 100644 --- a/core/lib/Thelia/Core/Event/Folder/FolderCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Folder/FolderCreateEvent.php @@ -24,13 +24,13 @@ namespace Thelia\Core\Event\Folder; use Thelia\Core\Event\Folder\FolderEvent; - /** * Class FolderCreateEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class FolderCreateEvent extends FolderEvent { +class FolderCreateEvent extends FolderEvent +{ protected $title; protected $parent; protected $locale; @@ -117,5 +117,4 @@ class FolderCreateEvent extends FolderEvent { return $this->visible; } - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Folder/FolderDeleteEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderDeleteEvent.php index ef3b875c2..4dd251179 100644 --- a/core/lib/Thelia/Core/Event/Folder/FolderDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Folder/FolderDeleteEvent.php @@ -24,14 +24,13 @@ namespace Thelia\Core\Event\Folder; use Thelia\Core\Event\Folder\FolderEvent; - /** * Class FolderDeleteEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class FolderDeleteEvent extends FolderEvent{ - +class FolderDeleteEvent extends FolderEvent +{ /** * @var int folder id */ @@ -40,7 +39,7 @@ class FolderDeleteEvent extends FolderEvent{ /** * @param int $folder_id */ - function __construct($folder_id) + public function __construct($folder_id) { $this->folder_id = $folder_id; } @@ -61,5 +60,4 @@ class FolderDeleteEvent extends FolderEvent{ return $this->folder_id; } - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Folder/FolderEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderEvent.php index d45dabb91..62eaddf39 100644 --- a/core/lib/Thelia/Core/Event/Folder/FolderEvent.php +++ b/core/lib/Thelia/Core/Event/Folder/FolderEvent.php @@ -25,20 +25,19 @@ namespace Thelia\Core\Event\Folder; use Thelia\Core\Event\ActionEvent; use Thelia\Model\Folder; - /** * Class FolderEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class FolderEvent extends ActionEvent { - +class FolderEvent extends ActionEvent +{ /** * @var \Thelia\Model\Folder */ protected $folder; - function __construct(Folder $folder = null) + public function __construct(Folder $folder = null) { $this->folder = $folder; } @@ -71,4 +70,4 @@ class FolderEvent extends ActionEvent { return null !== $this->folder; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Folder/FolderToggleVisibilityEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderToggleVisibilityEvent.php index 120ec29ba..d6bf24297 100644 --- a/core/lib/Thelia/Core/Event/Folder/FolderToggleVisibilityEvent.php +++ b/core/lib/Thelia/Core/Event/Folder/FolderToggleVisibilityEvent.php @@ -24,12 +24,11 @@ namespace Thelia\Core\Event\Folder; use Thelia\Core\Event\Folder\FolderEvent; - /** * Class FolderToggleVisibilityEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class FolderToggleVisibilityEvent extends FolderEvent { - -} \ No newline at end of file +class FolderToggleVisibilityEvent extends FolderEvent +{ +} diff --git a/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php b/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php index e2b6c5805..bb4234d6c 100644 --- a/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Folder/FolderUpdateEvent.php @@ -24,13 +24,13 @@ namespace Thelia\Core\Event\Folder; use Thelia\Core\Event\Folder\FolderCreateEvent; - /** * Class FolderUpdateEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class FolderUpdateEvent extends FolderCreateEvent { +class FolderUpdateEvent extends FolderCreateEvent +{ protected $folder_id; protected $chapo; @@ -39,7 +39,7 @@ class FolderUpdateEvent extends FolderCreateEvent { protected $url; - function __construct($folder_id) + public function __construct($folder_id) { $this->folder_id = $folder_id; } @@ -134,4 +134,4 @@ class FolderUpdateEvent extends FolderCreateEvent { return $this->url; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/GenerateRewrittenUrlEvent.php b/core/lib/Thelia/Core/Event/GenerateRewrittenUrlEvent.php index 7ee22cddd..95604ceb5 100644 --- a/core/lib/Thelia/Core/Event/GenerateRewrittenUrlEvent.php +++ b/core/lib/Thelia/Core/Event/GenerateRewrittenUrlEvent.php @@ -23,14 +23,13 @@ namespace Thelia\Core\Event; - /** * Class GenerateRewrittenUrlEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class GenerateRewrittenUrlEvent extends ActionEvent { - +class GenerateRewrittenUrlEvent extends ActionEvent +{ protected $object; protected $locale; @@ -57,4 +56,4 @@ class GenerateRewrittenUrlEvent extends ActionEvent { return $this->url; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Image/ImageCreateOrUpdateEvent.php b/core/lib/Thelia/Core/Event/Image/ImageCreateOrUpdateEvent.php index 6183e74ab..ea870dd14 100755 --- a/core/lib/Thelia/Core/Event/Image/ImageCreateOrUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Image/ImageCreateOrUpdateEvent.php @@ -60,9 +60,9 @@ class ImageCreateOrUpdateEvent extends ActionEvent /** * Constructor * - * @param string $imageType Image type + * @param string $imageType Image type * ex : FileManager::TYPE_CATEGORY - * @param int $parentId Image parent id + * @param int $parentId Image parent id */ public function __construct($imageType, $parentId) { @@ -210,5 +210,4 @@ class ImageCreateOrUpdateEvent extends ActionEvent return $this->oldModelImage; } - } diff --git a/core/lib/Thelia/Core/Event/Image/ImageDeleteEvent.php b/core/lib/Thelia/Core/Event/Image/ImageDeleteEvent.php index 9de9b1475..d3ba94374 100755 --- a/core/lib/Thelia/Core/Event/Image/ImageDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Image/ImageDeleteEvent.php @@ -52,7 +52,7 @@ class ImageDeleteEvent extends ActionEvent * Constructor * * @param CategoryImage|ProductImage|ContentImage|FolderImage $imageToDelete Image about to be deleted - * @param string $imageType Image type + * @param string $imageType Image type * ex : FileManager::TYPE_CATEGORY */ public function __construct($imageToDelete, $imageType) @@ -109,5 +109,4 @@ class ImageDeleteEvent extends ActionEvent return $this->imageToDelete; } - } diff --git a/core/lib/Thelia/Core/Event/LostPasswordEvent.php b/core/lib/Thelia/Core/Event/LostPasswordEvent.php index fe1f9dc5f..78d786b2d 100644 --- a/core/lib/Thelia/Core/Event/LostPasswordEvent.php +++ b/core/lib/Thelia/Core/Event/LostPasswordEvent.php @@ -23,14 +23,13 @@ namespace Thelia\Core\Event; - /** * Class LostPasswordEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class LostPasswordEvent extends ActionEvent { - +class LostPasswordEvent extends ActionEvent +{ protected $email; public function __construct($email) @@ -46,6 +45,4 @@ class LostPasswordEvent extends ActionEvent { return $this->email; } - - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/MailTransporterEvent.php b/core/lib/Thelia/Core/Event/MailTransporterEvent.php index d47ac693f..5a133158e 100644 --- a/core/lib/Thelia/Core/Event/MailTransporterEvent.php +++ b/core/lib/Thelia/Core/Event/MailTransporterEvent.php @@ -23,13 +23,13 @@ namespace Thelia\Core\Event; - /** * Class MailTransporterEvent * @package Thelia\Core\Event * @author Manuel Raynaud */ -class MailTransporterEvent extends ActionEvent { +class MailTransporterEvent extends ActionEvent +{ /** * @var \Swift_Transport */ @@ -49,4 +49,4 @@ class MailTransporterEvent extends ActionEvent { { return null !== $this->transporter; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Product/ProductCreateEvent.php b/core/lib/Thelia/Core/Event/Product/ProductCreateEvent.php index ea8243d19..7ca20ebc0 100644 --- a/core/lib/Thelia/Core/Event/Product/ProductCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductCreateEvent.php @@ -46,6 +46,7 @@ class ProductCreateEvent extends ProductEvent public function setRef($ref) { $this->ref = $ref; + return $this; } @@ -57,6 +58,7 @@ class ProductCreateEvent extends ProductEvent public function setTitle($title) { $this->title = $title; + return $this; } @@ -68,6 +70,7 @@ class ProductCreateEvent extends ProductEvent public function setLocale($locale) { $this->locale = $locale; + return $this; } @@ -79,6 +82,7 @@ class ProductCreateEvent extends ProductEvent public function setDefaultCategory($default_category) { $this->default_category = $default_category; + return $this; } @@ -90,6 +94,7 @@ class ProductCreateEvent extends ProductEvent public function setVisible($visible) { $this->visible = $visible; + return $this; } @@ -101,6 +106,7 @@ class ProductCreateEvent extends ProductEvent public function setBasePrice($basePrice) { $this->basePrice = $basePrice; + return $this; } @@ -112,6 +118,7 @@ class ProductCreateEvent extends ProductEvent public function setBaseWeight($baseWeight) { $this->baseWeight = $baseWeight; + return $this; } @@ -123,6 +130,7 @@ class ProductCreateEvent extends ProductEvent public function setTaxRuleId($taxRuleId) { $this->taxRuleId = $taxRuleId; + return $this; } @@ -134,6 +142,7 @@ class ProductCreateEvent extends ProductEvent public function setCurrencyId($currencyId) { $this->currencyId = $currencyId; + return $this; } } diff --git a/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php b/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php index fb72d5936..008ae0703 100644 --- a/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php +++ b/core/lib/Thelia/Core/Event/Product/ProductSetTemplateEvent.php @@ -24,7 +24,6 @@ namespace Thelia\Core\Event\Product; use Thelia\Core\Event\ProductEvent; use Thelia\Model\Product; -use Thelia\Core\Event\ActionEvent; class ProductSetTemplateEvent extends ProductEvent { diff --git a/core/lib/Thelia/Core/Event/Template/TemplateUpdateEvent.php b/core/lib/Thelia/Core/Event/Template/TemplateUpdateEvent.php index bce6216d9..aaf39708f 100644 --- a/core/lib/Thelia/Core/Event/Template/TemplateUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Template/TemplateUpdateEvent.php @@ -57,6 +57,7 @@ class TemplateUpdateEvent extends TemplateCreateEvent public function setFeatureList($feature_list) { $this->feature_list = $feature_list; + return $this; } @@ -68,6 +69,7 @@ class TemplateUpdateEvent extends TemplateCreateEvent public function setAttributeList($attribute_list) { $this->attribute_list = $attribute_list; + return $this; } } diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index 1eda9448d..451adf33b 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -331,7 +331,6 @@ final class TheliaEvents const ORDER_PRODUCT_BEFORE_CREATE = "action.orderProduct.beforeCreate"; const ORDER_PRODUCT_AFTER_CREATE = "action.orderProduct.afterCreate"; - /** * Sent on image processing */ @@ -571,7 +570,6 @@ final class TheliaEvents const BEFORE_DELETEATTRIBUTE_AV = "action.before_deleteAttributeAv"; const AFTER_DELETEATTRIBUTE_AV = "action.after_deleteAttributeAv"; - // -- Features values management ---------------------------------------- const FEATURE_AV_CREATE = "action.createFeatureAv"; diff --git a/core/lib/Thelia/Core/EventListener/ViewListener.php b/core/lib/Thelia/Core/EventListener/ViewListener.php index dac1f943d..aefc0cf90 100755 --- a/core/lib/Thelia/Core/EventListener/ViewListener.php +++ b/core/lib/Thelia/Core/EventListener/ViewListener.php @@ -100,7 +100,7 @@ class ViewListener implements EventSubscriberInterface // Redirect to the login template Redirect::exec($this->container->get('thelia.url.manager')->viewUrl($ex->getLoginTemplate())); } catch (OrderException $e) { - switch($e->getCode()) { + switch ($e->getCode()) { case OrderException::CART_EMPTY: // Redirect to the cart template Redirect::exec($this->container->get('router.chainRequest')->generate($e->cartRoute, $e->arguments, Router::ABSOLUTE_URL)); diff --git a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php index 798a9c7fd..09b932a98 100755 --- a/core/lib/Thelia/Core/HttpFoundation/Session/Session.php +++ b/core/lib/Thelia/Core/HttpFoundation/Session/Session.php @@ -51,10 +51,10 @@ class Session extends BaseSession public function getLang($forceDefault = true) { $lang = $this->get("thelia.current.lang"); - if(null === $lang && $forceDefault) - { + if (null === $lang && $forceDefault) { $lang = Lang::getDefaultLanguage(); } + return $lang; } @@ -74,10 +74,10 @@ class Session extends BaseSession { $currency = $this->get("thelia.current.currency"); - if(null === $currency && $forceDefault) - { + if (null === $currency && $forceDefault) { $currency = Currency::getDefaultCurrency(); } + return $currency; } @@ -108,6 +108,7 @@ class Session extends BaseSession if (null === $lang) { $lang = Lang::getDefaultLanguage(); } + return $lang; } @@ -187,7 +188,7 @@ class Session extends BaseSession $cart = null; if ($cart_id) { $cart = CartQuery::create()->findPk($cart_id); - if($cart) { + if ($cart) { try { $this->verifyValidCart($cart); } catch (InvalidCartException $e) { @@ -230,7 +231,6 @@ class Session extends BaseSession // -- Order ------------------------------------------------------------------ - public function setOrder(Order $order) { $this->set("thelia.order", $order); @@ -246,7 +246,6 @@ class Session extends BaseSession return $this->get("thelia.order"); } - /** * Set consumed coupons by the Customer * diff --git a/core/lib/Thelia/Core/HttpKernel/Exception/NotFountHttpException.php b/core/lib/Thelia/Core/HttpKernel/Exception/NotFountHttpException.php index a52f0eb86..41ca0bdc1 100644 --- a/core/lib/Thelia/Core/HttpKernel/Exception/NotFountHttpException.php +++ b/core/lib/Thelia/Core/HttpKernel/Exception/NotFountHttpException.php @@ -20,15 +20,15 @@ /* along with this program. If not, see . */ /* */ /*************************************************************************************/ -namespace Thelia\Core\HttpKernel\Exceptions; +namespace Thelia\Core\HttpKernel\Exception; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException as BaseNotFountHttpException; /** * Class NotFountHttpException * @author Manuel Raynaud */ -class NotFountHttpException extends BaseNotFountHttpException { - +class NotFountHttpException extends BaseNotFountHttpException +{ protected $adminContext = false; public function __construct($message = null, \Exception $previous = null, $code = 0, $adminContext = false) @@ -43,4 +43,4 @@ class NotFountHttpException extends BaseNotFountHttpException { return $this->adminContext === true; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Security/Authentication/TokenAuthenticator.php b/core/lib/Thelia/Core/Security/Authentication/TokenAuthenticator.php index 1c8c11c73..e00ae4375 100644 --- a/core/lib/Thelia/Core/Security/Authentication/TokenAuthenticator.php +++ b/core/lib/Thelia/Core/Security/Authentication/TokenAuthenticator.php @@ -24,7 +24,6 @@ namespace Thelia\Core\Security\Authentication; use Thelia\Core\Security\Authentication\AuthenticatorInterface; -use Thelia\Core\Security\UserProvider\UserProviderInterface; use Thelia\Core\Security\UserProvider\TokenUserProvider; use Thelia\Core\Security\Exception\TokenAuthenticationException; @@ -51,7 +50,6 @@ class TokenAuthenticator implements AuthenticatorInterface $user = $this->userProvider->getUser($keyData); if ($user === null) throw new TokenAuthenticationException("No user matches the provided token"); - return $user; } } diff --git a/core/lib/Thelia/Core/Security/Token/TokenProvider.php b/core/lib/Thelia/Core/Security/Token/TokenProvider.php index e50b60602..32c5b7d6c 100644 --- a/core/lib/Thelia/Core/Security/Token/TokenProvider.php +++ b/core/lib/Thelia/Core/Security/Token/TokenProvider.php @@ -6,8 +6,8 @@ use Thelia\Core\Security\User\UserInterface; class TokenProvider { - public function encodeKey(UserInterface $user) { - + public function encodeKey(UserInterface $user) + { // Always set a new token in the user environment $user->setToken(uniqid()); @@ -15,7 +15,8 @@ class TokenProvider array($user->getUsername(), $user->getToken(), $user->getSerial()))); } - public function decodeKey($key) { + public function decodeKey($key) + { $data = unserialize(base64_decode($key)); return array( diff --git a/core/lib/Thelia/Core/Security/User/UserInterface.php b/core/lib/Thelia/Core/Security/User/UserInterface.php index cdff4d44e..113909a41 100755 --- a/core/lib/Thelia/Core/Security/User/UserInterface.php +++ b/core/lib/Thelia/Core/Security/User/UserInterface.php @@ -68,4 +68,4 @@ interface UserInterface * Set a serial number int the user data (used by remember me authnetication system) */ public function setSerial($serial); -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Security/UserProvider/AdminTokenUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/AdminTokenUserProvider.php index 4567176e5..ca36fc29a 100644 --- a/core/lib/Thelia/Core/Security/UserProvider/AdminTokenUserProvider.php +++ b/core/lib/Thelia/Core/Security/UserProvider/AdminTokenUserProvider.php @@ -23,13 +23,12 @@ namespace Thelia\Core\Security\UserProvider; -use Thelia\Model\Admin; use Thelia\Model\AdminQuery; class AdminTokenUserProvider extends TokenUserProvider { - public function getUser($dataArray) { - + public function getUser($dataArray) + { return AdminQuery::create() ->filterByLogin($dataArray['username']) ->filterByRememberMeSerial($dataArray['serial']) diff --git a/core/lib/Thelia/Core/Security/UserProvider/CustomerTokenUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/CustomerTokenUserProvider.php index 421d48dd4..e0ea58b84 100644 --- a/core/lib/Thelia/Core/Security/UserProvider/CustomerTokenUserProvider.php +++ b/core/lib/Thelia/Core/Security/UserProvider/CustomerTokenUserProvider.php @@ -23,17 +23,16 @@ namespace Thelia\Core\Security\UserProvider; -use Thelia\Action\Customer; use Thelia\Model\CustomerQuery; class CustomerTokenUserProvider extends TokenUserProvider { - public function getUser($dataArray) { - + public function getUser($dataArray) + { return CustomerQuery::create() ->filterByEmail($dataArray['username']) ->filterByRememberMeSerial($dataArray['serial']) ->filterByRememberMeToken($dataArray['token']) ->findOne(); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php index 21db28cab..ccc15c3c7 100755 --- a/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php +++ b/core/lib/Thelia/Core/Security/UserProvider/CustomerUserProvider.php @@ -35,4 +35,4 @@ class CustomerUserProvider implements UserProviderInterface return $customer; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Security/UserProvider/TokenUserProvider.php b/core/lib/Thelia/Core/Security/UserProvider/TokenUserProvider.php index 6c46bcbbb..e58a2e123 100644 --- a/core/lib/Thelia/Core/Security/UserProvider/TokenUserProvider.php +++ b/core/lib/Thelia/Core/Security/UserProvider/TokenUserProvider.php @@ -23,10 +23,9 @@ namespace Thelia\Core\Security\UserProvider; -use Thelia\Core\Security\User\UserInterface; use Thelia\Core\Security\Token\TokenProvider; abstract class TokenUserProvider extends TokenProvider implements UserProviderInterface { - public abstract function getUser($key); + abstract public function getUser($key); } diff --git a/core/lib/Thelia/Core/Template/Loop/Accessory.php b/core/lib/Thelia/Core/Template/Loop/Accessory.php index 34d674c10..6b15a6715 100755 --- a/core/lib/Thelia/Core/Template/Loop/Accessory.php +++ b/core/lib/Thelia/Core/Template/Loop/Accessory.php @@ -117,7 +117,7 @@ class Accessory extends Product $loopResult = parent::exec($pagination); - foreach($loopResult as $loopResultRow) { + foreach ($loopResult as $loopResultRow) { $accessoryProductId = $loopResultRow->get('ID'); diff --git a/core/lib/Thelia/Core/Template/Loop/Address.php b/core/lib/Thelia/Core/Template/Loop/Address.php index 9ca4352e9..5fe20b0e4 100755 --- a/core/lib/Thelia/Core/Template/Loop/Address.php +++ b/core/lib/Thelia/Core/Template/Loop/Address.php @@ -112,7 +112,7 @@ class Address extends BaseLoop if ($default === true) { $search->filterByIsDefault(1, Criteria::EQUAL); - } else if($default === false) { + } elseif ($default === false) { $search->filterByIsDefault(0, Criteria::EQUAL); } diff --git a/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php b/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php index 418a76220..a9efad7ae 100755 --- a/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php +++ b/core/lib/Thelia/Core/Template/Loop/Argument/Argument.php @@ -60,10 +60,10 @@ class Argument { $x = $value === null; - if($value === null) { + if ($value === null) { $this->value = null; } else { - if(false === $value) { + if (false === $value) { /* (string) $value = "" */ $this->value = 0; } else { diff --git a/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php b/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php index 78794b715..6fc41fc9b 100755 --- a/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php +++ b/core/lib/Thelia/Core/Template/Loop/AssociatedContent.php @@ -159,7 +159,7 @@ class AssociatedContent extends Content $loopResult = parent::exec($pagination); - foreach($loopResult as $loopResultRow) { + foreach ($loopResult as $loopResultRow) { $relatedContentId = $loopResultRow->get('ID'); diff --git a/core/lib/Thelia/Core/Template/Loop/Attribute.php b/core/lib/Thelia/Core/Template/Loop/Attribute.php index 9a9aa6ff3..daad80979 100755 --- a/core/lib/Thelia/Core/Template/Loop/Attribute.php +++ b/core/lib/Thelia/Core/Template/Loop/Attribute.php @@ -31,17 +31,12 @@ use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; -use Thelia\Model\Base\CategoryQuery; -use Thelia\Model\Base\ProductCategoryQuery; use Thelia\Model\Base\AttributeQuery; -use Thelia\Model\Map\ProductCategoryTableMap; use Thelia\Type\TypeCollection; use Thelia\Type; -use Thelia\Type\BooleanOrBothType; use Thelia\Model\ProductQuery; use Thelia\Model\TemplateQuery; use Thelia\Model\AttributeTemplateQuery; -use Thelia\Core\Translation\Translator; use Thelia\Model\Map\AttributeTemplateTableMap; /** * @@ -121,7 +116,7 @@ class Attribute extends BaseI18nLoop // Create template array if ($template == null) $template = array(); - foreach($products as $product) { + foreach ($products as $product) { $tpl_id = $product->getTemplateId(); if (! is_null($tpl_id)) $template[] = $tpl_id; @@ -138,8 +133,7 @@ class Attribute extends BaseI18nLoop ; $use_attribute_pos = false; - } - else if (null !== $exclude_template) { + } elseif (null !== $exclude_template) { // Join with attribute_template table to get position $exclude_attributes = AttributeTemplateQuery::create()->filterByTemplateId($exclude_template)->select('attribute_id')->find(); diff --git a/core/lib/Thelia/Core/Template/Loop/Coupon.php b/core/lib/Thelia/Core/Template/Loop/Coupon.php index 6dd205d16..61e3b2762 100755 --- a/core/lib/Thelia/Core/Template/Loop/Coupon.php +++ b/core/lib/Thelia/Core/Template/Loop/Coupon.php @@ -37,7 +37,6 @@ use Thelia\Coupon\Type\CouponInterface; use Thelia\Model\Coupon as MCoupon; use Thelia\Model\CouponQuery; use Thelia\Type; -use Thelia\Type\BooleanOrBothType; /** * Created by JetBrains PhpStorm. diff --git a/core/lib/Thelia/Core/Template/Loop/Delivery.php b/core/lib/Thelia/Core/Template/Loop/Delivery.php index 5d33d398d..3a0c5cb31 100644 --- a/core/lib/Thelia/Core/Template/Loop/Delivery.php +++ b/core/lib/Thelia/Core/Template/Loop/Delivery.php @@ -57,9 +57,9 @@ class Delivery extends BaseSpecificModule $search->filterByType(BaseModule::DELIVERY_MODULE_TYPE, Criteria::EQUAL); $countryId = $this->getCountry(); - if(null !== $countryId) { + if (null !== $countryId) { $country = CountryQuery::create()->findPk($countryId); - if(null === $country) { + if (null === $country) { throw new \InvalidArgumentException('Cannot found country id: `' . $countryId . '` in delivery loop'); } } else { diff --git a/core/lib/Thelia/Core/Template/Loop/Document.php b/core/lib/Thelia/Core/Template/Loop/Document.php index c5a4da47c..9f99a6fa4 100644 --- a/core/lib/Thelia/Core/Template/Loop/Document.php +++ b/core/lib/Thelia/Core/Template/Loop/Document.php @@ -265,8 +265,7 @@ class Document extends BaseI18nLoop ; $loopResult->addRow($loopResultRow); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Ignore the result and log an error Tlog::getInstance()->addError("Failed to process document in document loop: ", $this->args); } diff --git a/core/lib/Thelia/Core/Template/Loop/Feature.php b/core/lib/Thelia/Core/Template/Loop/Feature.php index f542b2e8d..89b338b0f 100755 --- a/core/lib/Thelia/Core/Template/Loop/Feature.php +++ b/core/lib/Thelia/Core/Template/Loop/Feature.php @@ -31,11 +31,8 @@ use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; -use Thelia\Model\CategoryQuery; use Thelia\Model\FeatureI18nQuery; -use Thelia\Model\ProductCategoryQuery; use Thelia\Model\FeatureQuery; -use Thelia\Model\Map\ProductCategoryTableMap; use Thelia\Model\ProductQuery; use Thelia\Type\TypeCollection; use Thelia\Type; @@ -124,7 +121,7 @@ class Feature extends BaseI18nLoop // Create template array if ($template == null) $template = array(); - foreach($products as $product) { + foreach ($products as $product) { $tpl_id = $product->getTemplateId(); if (! is_null($tpl_id)) $template[] = $tpl_id; @@ -164,7 +161,7 @@ class Feature extends BaseI18nLoop ->select('id') ->find(); - if($features) { + if ($features) { $search->filterById( $features, Criteria::IN @@ -204,7 +201,6 @@ class Feature extends BaseI18nLoop } - /* perform search */ $features = $this->search($search, $pagination); diff --git a/core/lib/Thelia/Core/Template/Loop/Image.php b/core/lib/Thelia/Core/Template/Loop/Image.php index e37d0b406..b20b161a3 100755 --- a/core/lib/Thelia/Core/Template/Loop/Image.php +++ b/core/lib/Thelia/Core/Template/Loop/Image.php @@ -318,8 +318,7 @@ class Image extends BaseI18nLoop ; $loopResult->addRow($loopResultRow); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Ignore the result and log an error Tlog::getInstance()->addError("Failed to process image in image loop: ", $this->args); } diff --git a/core/lib/Thelia/Core/Template/Loop/Module.php b/core/lib/Thelia/Core/Template/Loop/Module.php index 1c4f91b4d..d780658c0 100755 --- a/core/lib/Thelia/Core/Template/Loop/Module.php +++ b/core/lib/Thelia/Core/Template/Loop/Module.php @@ -103,7 +103,7 @@ class Module extends BaseI18nLoop $active = $this->getActive(); - if($active !== Type\BooleanOrBothType::ANY) { + if ($active !== Type\BooleanOrBothType::ANY) { $search->filterByActivate($active ? 1 : 0, Criteria::EQUAL); } diff --git a/core/lib/Thelia/Core/Template/Loop/OrderAddress.php b/core/lib/Thelia/Core/Template/Loop/OrderAddress.php index ac2a7344b..38dcb0239 100755 --- a/core/lib/Thelia/Core/Template/Loop/OrderAddress.php +++ b/core/lib/Thelia/Core/Template/Loop/OrderAddress.php @@ -31,10 +31,7 @@ use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; -use Thelia\Model\AddressQuery; use Thelia\Model\OrderAddressQuery; -use Thelia\Type\TypeCollection; -use Thelia\Type; /** * diff --git a/core/lib/Thelia/Core/Template/Loop/OrderProduct.php b/core/lib/Thelia/Core/Template/Loop/OrderProduct.php index 7e14d91f5..ab1fa2ab1 100755 --- a/core/lib/Thelia/Core/Template/Loop/OrderProduct.php +++ b/core/lib/Thelia/Core/Template/Loop/OrderProduct.php @@ -31,13 +31,7 @@ use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; -use Thelia\Exception\TaxEngineException; use Thelia\Model\Base\OrderProductQuery; -use Thelia\Model\CountryQuery; -use Thelia\Model\CurrencyQuery; -use Thelia\Model\Map\OrderProductTableMap; -use Thelia\Type\TypeCollection; -use Thelia\Type; /** * @@ -76,7 +70,6 @@ class OrderProduct extends BaseLoop ->withColumn('SUM(`opt`.PROMO_AMOUNT)', 'TOTAL_PROMO_TAX') ->groupById(); - $order = $this->getOrder(); $search->filterByOrderId($order, Criteria::EQUAL); diff --git a/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php b/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php index 0e483ef81..623d0bae5 100755 --- a/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php +++ b/core/lib/Thelia/Core/Template/Loop/OrderProductAttributeCombination.php @@ -32,8 +32,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\Base\OrderProductAttributeCombinationQuery; -use Thelia\Model\Map\AttributeAvTableMap; -use Thelia\Model\Map\AttributeTableMap; use Thelia\Type\TypeCollection; use Thelia\Type; diff --git a/core/lib/Thelia/Core/Template/Loop/Payment.php b/core/lib/Thelia/Core/Template/Loop/Payment.php index 542ffb590..ca0aaa18f 100644 --- a/core/lib/Thelia/Core/Template/Loop/Payment.php +++ b/core/lib/Thelia/Core/Template/Loop/Payment.php @@ -25,7 +25,6 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; -use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Module\BaseModule; /** diff --git a/core/lib/Thelia/Core/Template/Loop/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php index 7c812d81f..f0bb95249 100755 --- a/core/lib/Thelia/Core/Template/Loop/Product.php +++ b/core/lib/Thelia/Core/Template/Loop/Product.php @@ -138,9 +138,9 @@ class Product extends BaseI18nLoop public function exec(&$pagination) { $currencyId = $this->getCurrency(); - if(null !== $currencyId) { + if (null !== $currencyId) { $currency = CurrencyQuery::create()->findOneById($currencyId); - if(null === $currency) { + if (null === $currency) { throw new \InvalidArgumentException('Cannot found currency id: `' . $currency . '` in product_sale_elements loop'); } } else { @@ -610,7 +610,7 @@ class Product extends BaseI18nLoop $taxedPrice = $product->getTaxedPrice( $taxCountry ); - } catch(TaxEngineException $e) { + } catch (TaxEngineException $e) { $taxedPrice = null; } diff --git a/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php b/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php index e25164456..aa71d2b3c 100755 --- a/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php +++ b/core/lib/Thelia/Core/Template/Loop/ProductSaleElements.php @@ -158,7 +158,7 @@ class ProductSaleElements extends BaseLoop $taxedPrice = $PSEValue->getTaxedPrice( $taxCountry ); - } catch(TaxEngineException $e) { + } catch (TaxEngineException $e) { $taxedPrice = null; } $promoPrice = $PSEValue->getPromoPrice(); @@ -166,7 +166,7 @@ class ProductSaleElements extends BaseLoop $taxedPromoPrice = $PSEValue->getTaxedPromoPrice( $taxCountry ); - } catch(TaxEngineException $e) { + } catch (TaxEngineException $e) { $taxedPromoPrice = null; } diff --git a/core/lib/Thelia/Core/Template/Loop/TaxRule.php b/core/lib/Thelia/Core/Template/Loop/TaxRule.php index 5851f631d..e1c30d177 100644 --- a/core/lib/Thelia/Core/Template/Loop/TaxRule.php +++ b/core/lib/Thelia/Core/Template/Loop/TaxRule.php @@ -132,4 +132,4 @@ class TaxRule extends BaseI18nLoop return $loopResult; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Template/Loop/Template.php b/core/lib/Thelia/Core/Template/Loop/Template.php index db8bca7ee..9eaa3ea4f 100644 --- a/core/lib/Thelia/Core/Template/Loop/Template.php +++ b/core/lib/Thelia/Core/Template/Loop/Template.php @@ -31,13 +31,8 @@ use Thelia\Core\Template\Element\LoopResultRow; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; -use Thelia\Model\Base\CategoryQuery; -use Thelia\Model\Base\ProductCategoryQuery; use Thelia\Model\Base\TemplateQuery; -use Thelia\Model\Map\ProductCategoryTableMap; -use Thelia\Type\TypeCollection; use Thelia\Type; -use Thelia\Type\BooleanOrBothType; /** * @@ -111,4 +106,4 @@ class Template extends BaseI18nLoop return $loopResult; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php index f39c2a768..315adf37e 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php @@ -162,14 +162,14 @@ class DataAccessFunctions extends AbstractSmartyPlugin public function countryDataAccess($params, $smarty) { - if(array_key_exists('defaultCountry', self::$dataAccessCache)) { + if (array_key_exists('defaultCountry', self::$dataAccessCache)) { $defaultCountry = self::$dataAccessCache['defaultCountry']; } else { $defaultCountry = CountryQuery::create()->findOneByByDefault(1); self::$dataAccessCache['defaultCountry'] = $defaultCountry; } - switch($params["attr"]) { + switch ($params["attr"]) { case "default": return $defaultCountry->getId(); } @@ -177,7 +177,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin public function cartDataAccess($params, $smarty) { - if(array_key_exists('currentCountry', self::$dataAccessCache)) { + if (array_key_exists('currentCountry', self::$dataAccessCache)) { $currentCountry = self::$dataAccessCache['currentCountry']; } else { $currentCountry = CountryQuery::create()->findOneById(64); // @TODO : make it magic @@ -186,7 +186,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin $cart = $this->getCart($this->request); $result = ""; - switch($params["attr"]) { + switch ($params["attr"]) { case "count_item": $result = $cart->getCartItems()->count(); break; @@ -205,7 +205,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin { $order = $this->request->getSession()->getOrder(); $attribute = $this->getNormalizedParam($params, array('attribute', 'attrib', 'attr')); - switch($attribute) { + switch ($attribute) { case 'postage': return $order->getPostage(); case 'delivery_address': @@ -246,7 +246,7 @@ class DataAccessFunctions extends AbstractSmartyPlugin */ protected function dataAccessWithI18n($objectLabel, $params, ModelCriteria $search, $columns = array('TITLE', 'CHAPO', 'DESCRIPTION', 'POSTSCRIPTUM'), $foreignTable = null, $foreignKey = 'ID') { - if(array_key_exists('data_' . $objectLabel, self::$dataAccessCache)) { + if (array_key_exists('data_' . $objectLabel, self::$dataAccessCache)) { $data = self::$dataAccessCache['data_' . $objectLabel]; } else { $lang = $this->getNormalizedParam($params, array('lang')); @@ -332,7 +332,6 @@ class DataAccessFunctions extends AbstractSmartyPlugin */ public function getPluginDescriptors() { - return array( new SmartyPluginDescriptor('function', 'admin', $this, 'adminDataAccess'), new SmartyPluginDescriptor('function', 'customer', $this, 'customerDataAccess'), diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php index 569aedb84..61a68fdc7 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php @@ -22,13 +22,9 @@ /*************************************************************************************/ namespace Thelia\Core\Template\Smarty\Plugins; -use Symfony\Component\Form\FormView; -use Thelia\Form\BaseForm; -use Thelia\Core\Template\Element\Exception\ElementNotFoundException; use Symfony\Component\HttpFoundation\Request; use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; -use Thelia\Core\Template\ParserContext; /** * Created by JetBrains PhpStorm. diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php index 4c953be3c..22d58b452 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php @@ -168,8 +168,7 @@ $val = $value[$key]; $this->assignFieldValues($template, $name, $val, $formFieldView->vars); } } -} -else { +} else { $this->assignFieldValues($template, $formFieldView->vars["full_name"], $fieldVars["value"], $formFieldView->vars); } */ diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php index 1492f45cd..b6e31aef0 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Security.php @@ -46,9 +46,9 @@ class Security extends AbstractSmartyPlugin /** * Process security check function * - * @param array $params - * @param unknown $smarty - * @return string no text is returned. + * @param array $params + * @param unknown $smarty + * @return string no text is returned. * @throws \Thelia\Core\Security\Exception\AuthenticationException */ public function checkAuthFunction($params, &$smarty) @@ -79,7 +79,7 @@ class Security extends AbstractSmartyPlugin public function checkCartNotEmptyFunction($params, &$smarty) { $cart = $this->request->getSession()->getCart(); - if($cart===null || $cart->countCartItems() == 0) { + if ($cart===null || $cart->countCartItems() == 0) { throw new OrderException('Cart must not be empty', OrderException::CART_EMPTY, array('empty' => 1)); } @@ -90,11 +90,11 @@ class Security extends AbstractSmartyPlugin { $order = $this->request->getSession()->getOrder(); /* Does address and module still exists ? We assume address owner can't change neither module type */ - if($order !== null) { + if ($order !== null) { $checkAddress = AddressQuery::create()->findPk($order->chosenDeliveryAddress); $checkModule = ModuleQuery::create()->findPk($order->getDeliveryModuleId()); } - if(null === $order || null == $checkAddress || null === $checkModule) { + if (null === $order || null == $checkAddress || null === $checkModule) { throw new OrderException('Delivery must be defined', OrderException::UNDEFINED_DELIVERY, array('missing' => 1)); } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php index bd2c10513..a076c808a 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php @@ -247,6 +247,7 @@ class TheliaLoop extends AbstractSmartyPlugin // Find pagination $pagination = self::getPagination($loopName); if ($pagination === null) { // loop gas no result + return ''; } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Type.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Type.php index 333a522ec..cc42a6b21 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Type.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Type.php @@ -23,26 +23,20 @@ namespace Thelia\Core\Template\Smarty\Plugins; -use Thelia\Core\HttpFoundation\Request; use Thelia\Core\Template\Smarty\SmartyPluginDescriptor; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; -use Thelia\Core\Security\SecurityContext; -use Thelia\Core\Security\Exception\AuthenticationException; -use Thelia\Exception\OrderException; -use Thelia\Model\AddressQuery; -use Thelia\Model\ModuleQuery; class Type extends AbstractSmartyPlugin { public function assertTypeModifier($value, $option) { $typeClass = "\\Thelia\\Type\\$option"; - if(!class_exists($typeClass)) { + if (!class_exists($typeClass)) { throw new \InvalidArgumentException(sprintf("Invalid type name `%s` in `assertType` modifier", $option)); } $typeInstance = new $typeClass(); - if(!$typeInstance->isValid($value)) { + if (!$typeInstance->isValid($value)) { return ''; } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php index c74d1d2b3..d8227092f 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/UrlGenerator.php @@ -55,11 +55,9 @@ class UrlGenerator extends AbstractSmartyPlugin if ($file !== null) { $path = $file; $mode = URL::PATH_TO_FILE; - } - else if ($path !== null) { + } elseif ($path !== null) { $mode = URL::WITH_INDEX_PAGE; - } - else { + } else { throw \InvalidArgumentException(Translator::getInstance()->trans("Please specify either 'path' or 'file' parameter in {url} function.")); } @@ -74,7 +72,6 @@ class UrlGenerator extends AbstractSmartyPlugin if ($noamp == null) $url = str_replace('&', '&', $url); if ($target != null) $url .= '#'.$target; - return $url; } diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index dbfe48e17..199a0bb0b 100755 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -87,7 +87,6 @@ class Thelia extends Kernel $con->useDebug(true); } - } /** diff --git a/core/lib/Thelia/Core/TheliaHttpKernel.php b/core/lib/Thelia/Core/TheliaHttpKernel.php index 93a9e6b41..07dc15eed 100755 --- a/core/lib/Thelia/Core/TheliaHttpKernel.php +++ b/core/lib/Thelia/Core/TheliaHttpKernel.php @@ -148,7 +148,7 @@ class TheliaHttpKernel extends HttpKernel $currency = null; if ($request->query->has("currency")) { $currency = Model\CurrencyQuery::create()->findOneByCode($request->query->get("currency")); - if($currency) { + if ($currency) { $this->container->get("event_dispatcher")->dispatch(TheliaEvents::CHANGE_DEFAULT_CURRENCY, new CurrencyEvent($currency)); } } else { diff --git a/core/lib/Thelia/Exception/OrderException.php b/core/lib/Thelia/Exception/OrderException.php index 70fd21c01..676447858 100755 --- a/core/lib/Thelia/Exception/OrderException.php +++ b/core/lib/Thelia/Exception/OrderException.php @@ -41,7 +41,7 @@ class OrderException extends \RuntimeException public function __construct($message, $code = null, $arguments = array(), $previous = null) { - if(is_array($arguments)) { + if (is_array($arguments)) { $this->arguments = $arguments; } if ($code === null) { diff --git a/core/lib/Thelia/Form/AddressCreateForm.php b/core/lib/Thelia/Form/AddressCreateForm.php index 483366a1f..0774f253d 100644 --- a/core/lib/Thelia/Form/AddressCreateForm.php +++ b/core/lib/Thelia/Form/AddressCreateForm.php @@ -102,7 +102,7 @@ class AddressCreateForm extends BaseForm "for" => "address1_create" ) )) - ->add("address2", "text", array( + ->add("address2", "text", array( "label" => Translator::getInstance()->trans("Additional address"), "label_attr" => array( "for" => "address2_create" diff --git a/core/lib/Thelia/Form/AddressUpdateForm.php b/core/lib/Thelia/Form/AddressUpdateForm.php index 4fcf6e29c..055b233c9 100644 --- a/core/lib/Thelia/Form/AddressUpdateForm.php +++ b/core/lib/Thelia/Form/AddressUpdateForm.php @@ -103,7 +103,7 @@ class AddressUpdateForm extends AddressCreateForm "for" => "address1_update" ) )) - ->add("address2", "text", array( + ->add("address2", "text", array( "label" => Translator::getInstance()->trans("Additional address"), "label_attr" => array( "for" => "address2_update" diff --git a/core/lib/Thelia/Form/AdminLogin.php b/core/lib/Thelia/Form/AdminLogin.php index 00236161d..ff26bdc8d 100755 --- a/core/lib/Thelia/Form/AdminLogin.php +++ b/core/lib/Thelia/Form/AdminLogin.php @@ -51,7 +51,7 @@ class AdminLogin extends BaseForm ) )) ->add("remember_me", "checkbox", array( - 'value' => 'yes', + 'value' => 'yes', "label" => Translator::getInstance()->trans("Remember me ?"), "label_attr" => array( "for" => "remember_me" diff --git a/core/lib/Thelia/Form/AttributeAvCreationForm.php b/core/lib/Thelia/Form/AttributeAvCreationForm.php index 2ad202e1d..513fc0c6b 100644 --- a/core/lib/Thelia/Form/AttributeAvCreationForm.php +++ b/core/lib/Thelia/Form/AttributeAvCreationForm.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; @@ -59,4 +57,4 @@ class AttributeAvCreationForm extends BaseForm { return "thelia_attributeav_creation"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/AttributeCreationForm.php b/core/lib/Thelia/Form/AttributeCreationForm.php index a4c6d402f..dc65cc16c 100644 --- a/core/lib/Thelia/Form/AttributeCreationForm.php +++ b/core/lib/Thelia/Form/AttributeCreationForm.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; diff --git a/core/lib/Thelia/Form/AttributeModificationForm.php b/core/lib/Thelia/Form/AttributeModificationForm.php index 45dab7b28..51d4f6c3a 100644 --- a/core/lib/Thelia/Form/AttributeModificationForm.php +++ b/core/lib/Thelia/Form/AttributeModificationForm.php @@ -23,10 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; -use Symfony\Component\Validator\Constraints\NotBlank; -use Thelia\Core\Translation\Translator; use Symfony\Component\Validator\Constraints\GreaterThan; class AttributeModificationForm extends AttributeCreationForm diff --git a/core/lib/Thelia/Form/CategoryDocumentModification.php b/core/lib/Thelia/Form/CategoryDocumentModification.php index 47c637df0..9ad7ba890 100644 --- a/core/lib/Thelia/Form/CategoryDocumentModification.php +++ b/core/lib/Thelia/Form/CategoryDocumentModification.php @@ -22,10 +22,7 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\DocumentModification; -use Thelia\Form\Image\ImageModification; /** * Created by JetBrains PhpStorm. diff --git a/core/lib/Thelia/Form/CategoryImageModification.php b/core/lib/Thelia/Form/CategoryImageModification.php index 06674d9ef..6f24263eb 100644 --- a/core/lib/Thelia/Form/CategoryImageModification.php +++ b/core/lib/Thelia/Form/CategoryImageModification.php @@ -22,8 +22,6 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\ImageModification; /** diff --git a/core/lib/Thelia/Form/ContentDocumentModification.php b/core/lib/Thelia/Form/ContentDocumentModification.php index 748eec0ec..d9d7c0571 100644 --- a/core/lib/Thelia/Form/ContentDocumentModification.php +++ b/core/lib/Thelia/Form/ContentDocumentModification.php @@ -22,10 +22,7 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\DocumentModification; -use Thelia\Form\Image\ImageModification; /** * Created by JetBrains PhpStorm. diff --git a/core/lib/Thelia/Form/ContentImageModification.php b/core/lib/Thelia/Form/ContentImageModification.php index f40fc5497..d80e47224 100644 --- a/core/lib/Thelia/Form/ContentImageModification.php +++ b/core/lib/Thelia/Form/ContentImageModification.php @@ -22,8 +22,6 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\ImageModification; /** diff --git a/core/lib/Thelia/Form/ContentModificationForm.php b/core/lib/Thelia/Form/ContentModificationForm.php index 38ad4e2cf..14789ab84 100644 --- a/core/lib/Thelia/Form/ContentModificationForm.php +++ b/core/lib/Thelia/Form/ContentModificationForm.php @@ -33,7 +33,8 @@ use Thelia\Form\StandardDescriptionFieldsTrait; * @package Thelia\Form * @author manuel raynaud */ -class ContentModificationForm extends ContentCreationForm { +class ContentModificationForm extends ContentCreationForm +{ use StandardDescriptionFieldsTrait; protected function buildForm() @@ -58,4 +59,4 @@ class ContentModificationForm extends ContentCreationForm { { return "thelia_content_modification"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/CountryCreationForm.php b/core/lib/Thelia/Form/CountryCreationForm.php index ad6701a64..1b10ebc07 100644 --- a/core/lib/Thelia/Form/CountryCreationForm.php +++ b/core/lib/Thelia/Form/CountryCreationForm.php @@ -38,7 +38,7 @@ class CountryCreationForm extends BaseForm "label_attr" => array( "for" => "title" ) - )) + )) ->add("area", "text", array( "constraints" => array( new NotBlank() @@ -47,7 +47,7 @@ class CountryCreationForm extends BaseForm "label_attr" => array( "for" => "area" ) - )) + )) ->add("isocode", "text", array( "constraints" => array( new NotBlank() @@ -56,7 +56,7 @@ class CountryCreationForm extends BaseForm "label_attr" => array( "for" => "isocode" ) - )) + )) ->add("isoalpha2", "text", array( "constraints" => array( new NotBlank() @@ -65,7 +65,7 @@ class CountryCreationForm extends BaseForm "label_attr" => array( "for" => "isoalpha2" ) - )) + )) ->add("isoalpha3", "text", array( "constraints" => array( new NotBlank() @@ -74,7 +74,7 @@ class CountryCreationForm extends BaseForm "label_attr" => array( "for" => "isoalpha3" ) - )) + )) ; } diff --git a/core/lib/Thelia/Form/CountryModificationForm.php b/core/lib/Thelia/Form/CountryModificationForm.php index 4c1581664..757db19d0 100644 --- a/core/lib/Thelia/Form/CountryModificationForm.php +++ b/core/lib/Thelia/Form/CountryModificationForm.php @@ -42,7 +42,7 @@ class CountryModificationForm extends CurrencyCreationForm "label_attr" => array( "for" => "title" ) - )) + )) ->add("short-description", "text", array( "constraints" => array( new NotBlank() @@ -51,7 +51,7 @@ class CountryModificationForm extends CurrencyCreationForm "label_attr" => array( "for" => "short-description" ) - )) + )) ->add("description", "text", array( "constraints" => array( new NotBlank() @@ -60,7 +60,7 @@ class CountryModificationForm extends CurrencyCreationForm "label_attr" => array( "for" => "description" ) - )) + )) ->add("area", "text", array( "constraints" => array( new NotBlank() @@ -69,7 +69,7 @@ class CountryModificationForm extends CurrencyCreationForm "label_attr" => array( "for" => "area" ) - )) + )) ->add("isocode", "text", array( "constraints" => array( new NotBlank() @@ -78,7 +78,7 @@ class CountryModificationForm extends CurrencyCreationForm "label_attr" => array( "for" => "isocode" ) - )) + )) ->add("isoalpha2", "text", array( "constraints" => array( new NotBlank() @@ -87,7 +87,7 @@ class CountryModificationForm extends CurrencyCreationForm "label_attr" => array( "for" => "isoalpha2" ) - )) + )) ->add("isoalpha3", "text", array( "constraints" => array( new NotBlank() diff --git a/core/lib/Thelia/Form/CouponCreationForm.php b/core/lib/Thelia/Form/CouponCreationForm.php index f3ee0df63..8edc26fbf 100755 --- a/core/lib/Thelia/Form/CouponCreationForm.php +++ b/core/lib/Thelia/Form/CouponCreationForm.php @@ -24,7 +24,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints\Date; -use Symfony\Component\Validator\Constraints\DateTime; use Symfony\Component\Validator\Constraints\GreaterThanOrEqual; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotEqualTo; diff --git a/core/lib/Thelia/Form/CustomerCreation.php b/core/lib/Thelia/Form/CustomerCreation.php index 24e64faff..cc74585e7 100755 --- a/core/lib/Thelia/Form/CustomerCreation.php +++ b/core/lib/Thelia/Form/CustomerCreation.php @@ -220,4 +220,4 @@ class CustomerCreation extends BaseForm { return "thelia_customer_creation"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/CustomerLostPasswordForm.php b/core/lib/Thelia/Form/CustomerLostPasswordForm.php index d950bf614..83ff1f3d6 100644 --- a/core/lib/Thelia/Form/CustomerLostPasswordForm.php +++ b/core/lib/Thelia/Form/CustomerLostPasswordForm.php @@ -35,8 +35,8 @@ use Thelia\Model\CustomerQuery; * @package Thelia\Form * @author Manuel Raynaud */ -class CustomerLostPasswordForm extends BaseForm { - +class CustomerLostPasswordForm extends BaseForm +{ /** * * in this function you add all the fields you need for your Form. @@ -93,4 +93,4 @@ class CustomerLostPasswordForm extends BaseForm { { return "thelia_customer_creation"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/FeatureAvCreationForm.php b/core/lib/Thelia/Form/FeatureAvCreationForm.php index 504cc9338..9245bf28d 100644 --- a/core/lib/Thelia/Form/FeatureAvCreationForm.php +++ b/core/lib/Thelia/Form/FeatureAvCreationForm.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; @@ -59,4 +57,4 @@ class FeatureAvCreationForm extends BaseForm { return "thelia_featureav_creation"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/FeatureCreationForm.php b/core/lib/Thelia/Form/FeatureCreationForm.php index 1977bd78b..cbbc7692f 100644 --- a/core/lib/Thelia/Form/FeatureCreationForm.php +++ b/core/lib/Thelia/Form/FeatureCreationForm.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; diff --git a/core/lib/Thelia/Form/FeatureModificationForm.php b/core/lib/Thelia/Form/FeatureModificationForm.php index 1702f299e..576db4bfc 100644 --- a/core/lib/Thelia/Form/FeatureModificationForm.php +++ b/core/lib/Thelia/Form/FeatureModificationForm.php @@ -23,10 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; -use Symfony\Component\Validator\Constraints\NotBlank; -use Thelia\Core\Translation\Translator; use Symfony\Component\Validator\Constraints\GreaterThan; class FeatureModificationForm extends FeatureCreationForm diff --git a/core/lib/Thelia/Form/FolderDocumentModification.php b/core/lib/Thelia/Form/FolderDocumentModification.php index bbf57ab9d..47bcd7c7f 100644 --- a/core/lib/Thelia/Form/FolderDocumentModification.php +++ b/core/lib/Thelia/Form/FolderDocumentModification.php @@ -22,10 +22,7 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\DocumentModification; -use Thelia\Form\Image\ImageModification; /** * Created by JetBrains PhpStorm. diff --git a/core/lib/Thelia/Form/FolderImageModification.php b/core/lib/Thelia/Form/FolderImageModification.php index a9305433b..004c4676b 100644 --- a/core/lib/Thelia/Form/FolderImageModification.php +++ b/core/lib/Thelia/Form/FolderImageModification.php @@ -22,8 +22,6 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\ImageModification; /** diff --git a/core/lib/Thelia/Form/Image/DocumentModification.php b/core/lib/Thelia/Form/Image/DocumentModification.php index 39ba559be..31de5af98 100644 --- a/core/lib/Thelia/Form/Image/DocumentModification.php +++ b/core/lib/Thelia/Form/Image/DocumentModification.php @@ -22,7 +22,6 @@ /*************************************************************************************/ namespace Thelia\Form\Image; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Validator\Constraints\Image; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; diff --git a/core/lib/Thelia/Form/Image/ImageModification.php b/core/lib/Thelia/Form/Image/ImageModification.php index c4d26378b..e95a39c37 100644 --- a/core/lib/Thelia/Form/Image/ImageModification.php +++ b/core/lib/Thelia/Form/Image/ImageModification.php @@ -22,7 +22,6 @@ /*************************************************************************************/ namespace Thelia\Form\Image; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Validator\Constraints\Image; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; diff --git a/core/lib/Thelia/Form/OrderDelivery.php b/core/lib/Thelia/Form/OrderDelivery.php index 8cddb5bd9..b7eb4696d 100755 --- a/core/lib/Thelia/Form/OrderDelivery.php +++ b/core/lib/Thelia/Form/OrderDelivery.php @@ -25,8 +25,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Model\AddressQuery; -use Thelia\Model\ConfigQuery; -use Thelia\Core\Translation\Translator; use Thelia\Model\ModuleQuery; use Thelia\Module\BaseModule; @@ -69,7 +67,7 @@ class OrderDelivery extends BaseForm $address = AddressQuery::create() ->findPk($value); - if(null === $address) { + if (null === $address) { $context->addViolation("Address ID not found"); } } @@ -82,7 +80,7 @@ class OrderDelivery extends BaseForm ->filterById($value) ->findOne(); - if(null === $module) { + if (null === $module) { $context->addViolation("Delivery module ID not found"); } @@ -98,4 +96,4 @@ class OrderDelivery extends BaseForm { return "thelia_order_delivery"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/OrderPayment.php b/core/lib/Thelia/Form/OrderPayment.php index 6a6305971..6a0d6ec61 100755 --- a/core/lib/Thelia/Form/OrderPayment.php +++ b/core/lib/Thelia/Form/OrderPayment.php @@ -25,8 +25,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Model\AddressQuery; -use Thelia\Model\ConfigQuery; -use Thelia\Core\Translation\Translator; use Thelia\Model\ModuleQuery; use Thelia\Module\BaseModule; @@ -69,7 +67,7 @@ class OrderPayment extends BaseForm $address = AddressQuery::create() ->findPk($value); - if(null === $address) { + if (null === $address) { $context->addViolation("Address ID not found"); } } @@ -82,7 +80,7 @@ class OrderPayment extends BaseForm ->filterById($value) ->findOne(); - if(null === $module) { + if (null === $module) { $context->addViolation("Payment module ID not found"); } @@ -98,4 +96,4 @@ class OrderPayment extends BaseForm { return "thelia_order_payment"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/OrderUpdateAddress.php b/core/lib/Thelia/Form/OrderUpdateAddress.php index 21ddbf340..f8aabf628 100644 --- a/core/lib/Thelia/Form/OrderUpdateAddress.php +++ b/core/lib/Thelia/Form/OrderUpdateAddress.php @@ -92,7 +92,7 @@ class OrderUpdateAddress extends BaseForm "for" => "address1_update" ) )) - ->add("address2", "text", array( + ->add("address2", "text", array( "label" => Translator::getInstance()->trans("Additional address"), "label_attr" => array( "for" => "address2_update" @@ -165,7 +165,7 @@ class OrderUpdateAddress extends BaseForm $address = OrderAddressQuery::create() ->findPk($value); - if(null === $address) { + if (null === $address) { $context->addViolation("Order address ID not found"); } } @@ -175,7 +175,7 @@ class OrderUpdateAddress extends BaseForm $address = CustomerTitleQuery::create() ->findPk($value); - if(null === $address) { + if (null === $address) { $context->addViolation("Title ID not found"); } } @@ -185,7 +185,7 @@ class OrderUpdateAddress extends BaseForm $address = CountryQuery::create() ->findPk($value); - if(null === $address) { + if (null === $address) { $context->addViolation("Country ID not found"); } } diff --git a/core/lib/Thelia/Form/ProductDetailsModificationForm.php b/core/lib/Thelia/Form/ProductDetailsModificationForm.php index 7ded6ff69..dbc6bb238 100644 --- a/core/lib/Thelia/Form/ProductDetailsModificationForm.php +++ b/core/lib/Thelia/Form/ProductDetailsModificationForm.php @@ -87,4 +87,4 @@ class ProductDetailsModificationForm extends BaseForm { return "thelia_product_details_modification"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/ProductDocumentModification.php b/core/lib/Thelia/Form/ProductDocumentModification.php index 1a9bc5467..a9d7617e4 100644 --- a/core/lib/Thelia/Form/ProductDocumentModification.php +++ b/core/lib/Thelia/Form/ProductDocumentModification.php @@ -22,10 +22,7 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\DocumentModification; -use Thelia\Form\Image\ImageModification; /** * Created by JetBrains PhpStorm. diff --git a/core/lib/Thelia/Form/ProductImageModification.php b/core/lib/Thelia/Form/ProductImageModification.php index 2d35e176f..9c81ca839 100644 --- a/core/lib/Thelia/Form/ProductImageModification.php +++ b/core/lib/Thelia/Form/ProductImageModification.php @@ -22,8 +22,6 @@ /*************************************************************************************/ namespace Thelia\Form; - -use Thelia\Core\Translation\Translator; use Thelia\Form\Image\ImageModification; /** diff --git a/core/lib/Thelia/Form/ProductModificationForm.php b/core/lib/Thelia/Form/ProductModificationForm.php index dbda15eaa..34785cf45 100644 --- a/core/lib/Thelia/Form/ProductModificationForm.php +++ b/core/lib/Thelia/Form/ProductModificationForm.php @@ -61,4 +61,4 @@ class ProductModificationForm extends ProductCreationForm { return "thelia_product_modification"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/ProfileModificationForm.php b/core/lib/Thelia/Form/ProfileModificationForm.php index e3119cfee..618fbdfb4 100644 --- a/core/lib/Thelia/Form/ProfileModificationForm.php +++ b/core/lib/Thelia/Form/ProfileModificationForm.php @@ -35,7 +35,6 @@ use Thelia\Model\ConfigQuery; class ProfileModificationForm extends BaseForm { - protected function buildForm() { diff --git a/core/lib/Thelia/Form/TemplateCreationForm.php b/core/lib/Thelia/Form/TemplateCreationForm.php index 42e6db5a4..82d3560eb 100644 --- a/core/lib/Thelia/Form/TemplateCreationForm.php +++ b/core/lib/Thelia/Form/TemplateCreationForm.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; diff --git a/core/lib/Thelia/Form/TemplateModificationForm.php b/core/lib/Thelia/Form/TemplateModificationForm.php index b2b50a3ca..7d4248143 100644 --- a/core/lib/Thelia/Form/TemplateModificationForm.php +++ b/core/lib/Thelia/Form/TemplateModificationForm.php @@ -23,10 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\CurrencyQuery; -use Symfony\Component\Validator\ExecutionContextInterface; -use Symfony\Component\Validator\Constraints\NotBlank; -use Thelia\Core\Translation\Translator; use Symfony\Component\Validator\Constraints\GreaterThan; class TemplateModificationForm extends TemplateCreationForm diff --git a/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php index 8efc76e6e..37c40c953 100755 --- a/core/lib/Thelia/Module/BaseModule.php +++ b/core/lib/Thelia/Module/BaseModule.php @@ -51,12 +51,12 @@ abstract class BaseModule extends ContainerAware public function activate() { $moduleModel = $this->getModuleModel(); - if($moduleModel->getActivate() == self::IS_NOT_ACTIVATED) { + if ($moduleModel->getActivate() == self::IS_NOT_ACTIVATED) { $moduleModel->setActivate(self::IS_ACTIVATED); $moduleModel->save(); try { $this->afterActivation(); - } catch(\Exception $e) { + } catch (\Exception $e) { $moduleModel->setActivate(self::IS_NOT_ACTIVATED); $moduleModel->save(); throw $e; @@ -80,10 +80,10 @@ abstract class BaseModule extends ContainerAware public function setTitle(Module $module, $titles) { - if(is_array($titles)) { - foreach($titles as $locale => $title) { + if (is_array($titles)) { + foreach ($titles as $locale => $title) { $moduleI18n = ModuleI18nQuery::create()->filterById($module->getId())->filterByLocale($locale)->findOne(); - if(null === $moduleI18n) { + if (null === $moduleI18n) { $moduleI18n = new ModuleI18n(); $moduleI18n ->setId($module->getId()) @@ -103,7 +103,7 @@ abstract class BaseModule extends ContainerAware { try { $directoryBrowser = new \DirectoryIterator($folderPath); - } catch(\UnexpectedValueException $e) { + } catch (\UnexpectedValueException $e) { throw $e; } @@ -113,7 +113,7 @@ abstract class BaseModule extends ContainerAware /* browse the directory */ $imagePosition = 1; - foreach($directoryBrowser as $directoryContent) { + foreach ($directoryBrowser as $directoryContent) { /* is it a file ? */ if ($directoryContent->isFile()) { @@ -121,7 +121,7 @@ abstract class BaseModule extends ContainerAware $filePath = $directoryContent->getPathName(); /* is it a picture ? */ - if( Image::isImage($filePath) ) { + if ( Image::isImage($filePath) ) { $con->beginTransaction(); @@ -134,7 +134,7 @@ abstract class BaseModule extends ContainerAware $imageFileName = sprintf("%s-%d-%s", $module->getCode(), $image->getId(), $fileName); $increment = 0; - while(file_exists($imageDirectory . '/' . $imageFileName)) { + while (file_exists($imageDirectory . '/' . $imageFileName)) { $imageFileName = sprintf("%s-%d-%d-%s", $module->getCode(), $image->getId(), $increment, $fileName); $increment++; } @@ -142,13 +142,13 @@ abstract class BaseModule extends ContainerAware $imagePath = sprintf('%s/%s', $imageDirectory, $imageFileName); if (! is_dir($imageDirectory)) { - if(! @mkdir($imageDirectory, 0777, true)) { + if (! @mkdir($imageDirectory, 0777, true)) { $con->rollBack(); throw new ModuleException(sprintf("Cannot create directory : %s", $imageDirectory), ModuleException::CODE_NOT_FOUND); } } - if(! @copy($filePath, $imagePath)) { + if (! @copy($filePath, $imagePath)) { $con->rollBack(); throw new ModuleException(sprintf("Cannot copy file : %s to : %s", $filePath, $imagePath), ModuleException::CODE_NOT_FOUND); } @@ -171,7 +171,7 @@ abstract class BaseModule extends ContainerAware { $moduleModel = ModuleQuery::create()->findOneByCode($this->getCode()); - if(null === $moduleModel) { + if (null === $moduleModel) { throw new ModuleException(sprintf("Module Code `%s` not found", $this->getCode()), ModuleException::CODE_NOT_FOUND); } diff --git a/core/lib/Thelia/Module/PaymentModuleInterface.php b/core/lib/Thelia/Module/PaymentModuleInterface.php index d864ae50a..90f8ea0a9 100644 --- a/core/lib/Thelia/Module/PaymentModuleInterface.php +++ b/core/lib/Thelia/Module/PaymentModuleInterface.php @@ -23,8 +23,6 @@ namespace Thelia\Module; -use Thelia\Model\Country; - interface PaymentModuleInterface extends BaseModuleInterface { /** diff --git a/core/lib/Thelia/Tests/Action/CustomerTest.php b/core/lib/Thelia/Tests/Action/CustomerTest.php index 503faedbc..50ef4fde6 100644 --- a/core/lib/Thelia/Tests/Action/CustomerTest.php +++ b/core/lib/Thelia/Tests/Action/CustomerTest.php @@ -25,7 +25,6 @@ namespace Thelia\Tests\Action\ImageTest; use Thelia\Action\Customer; use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent; - /** * Class CustomerTest * @package Thelia\Tests\Action\ImageTest @@ -101,4 +100,4 @@ class CustomerTest extends \PHPUnit_Framework_TestCase $this->assertEquals($customerCreateEvent->getCellphone(), $addressCreated->getCellphone()); $this->assertEquals($customerCreateEvent->getCompany(), $addressCreated->getCompany()); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Action/OrderTest.php b/core/lib/Thelia/Tests/Action/OrderTest.php index eb9c8fc0b..67628e718 100644 --- a/core/lib/Thelia/Tests/Action/OrderTest.php +++ b/core/lib/Thelia/Tests/Action/OrderTest.php @@ -107,7 +107,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase /* load customer */ $this->customer = $this->loadCustomer(); - if(null === $this->customer) { + if (null === $this->customer) { return; } @@ -119,7 +119,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase public function loadCustomer() { $customer = CustomerQuery::create()->findOne(); - if(null === $customer) { + if (null === $customer) { return null; } @@ -141,7 +141,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase /* add 3 items */ $productList = array(); - for($i=0; $i<3; $i++) { + for ($i=0; $i<3; $i++) { $pse = ProductSaleElementsQuery::create() ->filterByProduct( ProductQuery::create() @@ -237,7 +237,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase ->filterByActivate(1) ->findOne(); - if(null === $deliveryModule) { + if (null === $deliveryModule) { throw new \Exception('No Delivery Module fixture found'); } @@ -246,7 +246,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase ->filterByActivate(1) ->findOne(); - if(null === $paymentModule) { + if (null === $paymentModule) { throw new \Exception('No Payment Module fixture found'); } @@ -258,7 +258,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase /* memorize current stocks */ $itemsStock = array(); - foreach($this->cartItems as $index => $cartItem) { + foreach ($this->cartItems as $index => $cartItem) { $itemsStock[$index] = $cartItem->getProductSaleElements()->getQuantity(); } @@ -318,7 +318,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase $this->assertEquals($this->container->get('request')->getSession()->getLang()->getId(), $placedOrder->getLangId(), 'lang does not match'); /* check ordered product */ - foreach($this->cartItems as $index => $cartItem) { + foreach ($this->cartItems as $index => $cartItem) { $orderProduct = OrderProductQuery::create() ->filterByOrderId($placedOrder->getId()) ->filterByProductRef($cartItem->getProduct()->getRef()) @@ -347,7 +347,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase /* check tax */ $orderProductTaxList = $orderProduct->getOrderProductTaxes(); - foreach($cartItem->getProduct()->getTaxRule()->getTaxDetail($validDeliveryAddress->getCountry(), $cartItem->getPrice(), $cartItem->getPromoPrice()) as $index => $tax) { + foreach ($cartItem->getProduct()->getTaxRule()->getTaxDetail($validDeliveryAddress->getCountry(), $cartItem->getPrice(), $cartItem->getPromoPrice()) as $index => $tax) { $orderProductTax = $orderProductTaxList[$index]; $this->assertEquals($tax->getAmount(), $orderProductTax->getAmount()); $this->assertEquals($tax->getPromoAmount(), $orderProductTax->getPromoAmount()); @@ -448,4 +448,4 @@ class OrderTest extends \PHPUnit_Framework_TestCase $this->assertEquals('J', $newOrderAddress->getPhone()); $this->assertEquals('K', $newOrderAddress->getCompany()); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php b/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php index 1d6d08e92..680a487aa 100755 --- a/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php +++ b/core/lib/Thelia/Tests/Command/ModuleActivateCommandTest.php @@ -40,7 +40,7 @@ class ModuleActivateCommandTest extends \PHPUnit_Framework_TestCase { $module = ModuleQuery::create()->findOne(); - if(null !== $module) { + if (null !== $module) { $application = new Application($this->getKernel()); $module->setActivate(BaseModule::IS_NOT_ACTIVATED); @@ -70,10 +70,9 @@ class ModuleActivateCommandTest extends \PHPUnit_Framework_TestCase { $testedModule = ModuleQuery::create()->findOneByCode('Letshopethismoduledoesnotexists'); - if(null == $testedModule) { + if (null == $testedModule) { $application = new Application($this->getKernel()); - $moduleActivate = new ModuleActivateCommand(); $moduleActivate->setContainer($this->getContainer()); diff --git a/core/lib/Thelia/Tests/Condition/ConditionEvaluatorTest.php b/core/lib/Thelia/Tests/Condition/ConditionEvaluatorTest.php index 7df8d6dfb..6e54417e3 100644 --- a/core/lib/Thelia/Tests/Condition/ConditionEvaluatorTest.php +++ b/core/lib/Thelia/Tests/Condition/ConditionEvaluatorTest.php @@ -23,7 +23,6 @@ namespace Thelia\Condition\Implementation; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Thelia\Condition\ConditionEvaluator; use Thelia\Condition\Operators; use Thelia\Coupon\AdapterInterface; diff --git a/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php b/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php index 97686e871..295d9a308 100644 --- a/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php +++ b/core/lib/Thelia/Tests/Condition/ConditionFactoryTest.php @@ -23,7 +23,6 @@ namespace Thelia\Condition\Implementation; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Thelia\Condition\ConditionEvaluator; use Thelia\Condition\ConditionFactory; use Thelia\Condition\Operators; @@ -95,7 +94,6 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase ->method('getContainer') ->will($this->returnValue($stubContainer)); - $condition1 = new MatchForTotalAmountManager($stubAdapter); $operators = array( MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, @@ -302,7 +300,6 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase ->method('getContainer') ->will($this->returnValue($stubContainer)); - $operators = array( MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmountManager::INPUT2 => Operators::EQUAL @@ -313,7 +310,6 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase ); $condition1->setValidatorsFromForm($operators, $values); - $conditions = new ConditionCollection(); $conditions->add($condition1); @@ -369,7 +365,6 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase ->method('getContainer') ->will($this->returnValue($stubContainer)); - $operators = array( MatchForTotalAmountManager::INPUT1 => Operators::SUPERIOR, MatchForTotalAmountManager::INPUT2 => Operators::EQUAL @@ -380,7 +375,6 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase ); $condition1->setValidatorsFromForm($operators, $values); - $conditions = new ConditionCollection(); $conditions->add($condition1); diff --git a/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneManagerTest.php b/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneManagerTest.php index 85e357eca..726ed4988 100644 --- a/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneManagerTest.php +++ b/core/lib/Thelia/Tests/Condition/Implementation/MatchForEveryoneManagerTest.php @@ -26,7 +26,6 @@ namespace Thelia\Condition\Implementation; use Thelia\Condition\ConditionEvaluator; use Thelia\Condition\Operators; use Thelia\Coupon\AdapterInterface; -use Thelia\Exception\InvalidConditionValueException; use Thelia\Model\Currency; /** @@ -105,7 +104,6 @@ class MatchForEveryoneManagerTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expected, $actual); } - /** * Check if condition is always matching * diff --git a/core/lib/Thelia/Tests/Condition/OperatorsTest.php b/core/lib/Thelia/Tests/Condition/OperatorsTest.php index 667714189..5d673e80b 100644 --- a/core/lib/Thelia/Tests/Condition/OperatorsTest.php +++ b/core/lib/Thelia/Tests/Condition/OperatorsTest.php @@ -103,12 +103,10 @@ class OperatorsTest extends \PHPUnit_Framework_TestCase { } - function callbackI18n() + public function callbackI18n() { $args = func_get_args(); return $args[0]; } } - - diff --git a/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php b/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php index eb271d4c1..056a14927 100755 --- a/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php +++ b/core/lib/Thelia/Tests/Core/Template/Element/BaseLoopTestor.php @@ -103,7 +103,6 @@ abstract class BaseLoopTestor extends \PHPUnit_Framework_TestCase $stubRequestContext )); - $this->container->set('request', $request); $this->container->set('event_dispatcher', new EventDispatcher()); $this->container->set('thelia.securityContext', new SecurityContext($request)); diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php index 2b7019879..cd3a47df0 100644 --- a/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/DocumentTest.php @@ -23,7 +23,6 @@ namespace Thelia\Tests\Core\Template\Loop; -use Thelia\Model\DocumentQuery; use Thelia\Tests\Core\Template\Element\BaseLoopTestor; use Thelia\Core\Template\Loop\Document; diff --git a/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php b/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php index ba4bfadc5..8c4906293 100644 --- a/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php +++ b/core/lib/Thelia/Tests/Core/Template/Loop/ImageTest.php @@ -23,7 +23,6 @@ namespace Thelia\Tests\Core\Template\Loop; -use Thelia\Model\ImageQuery; use Thelia\Tests\Core\Template\Element\BaseLoopTestor; use Thelia\Core\Template\Loop\Image; diff --git a/core/lib/Thelia/Tests/Module/BaseModuleTestor.php b/core/lib/Thelia/Tests/Module/BaseModuleTestor.php index ce70cd4ad..1a8de083a 100644 --- a/core/lib/Thelia/Tests/Module/BaseModuleTestor.php +++ b/core/lib/Thelia/Tests/Module/BaseModuleTestor.php @@ -23,7 +23,6 @@ namespace Thelia\Tests\Module; - /** * * @author Etienne Roudeix @@ -50,4 +49,3 @@ abstract class BaseModuleTestor extends \PHPUnit_Framework_TestCase $this->instance = $this->getTestedInstance(); } } - diff --git a/core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php b/core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php index 449a9162d..16b8e2f28 100644 --- a/core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php +++ b/core/lib/Thelia/Tests/Rewriting/BaseRewritingObject.php @@ -23,7 +23,6 @@ namespace Thelia\Tests\Rewriting; - /** * Class BaseRewritingObject * @package Thelia\Tests\Rewriting @@ -35,7 +34,7 @@ abstract class BaseRewritingObject extends \PHPUnit_Framework_TestCase /** * @return mixed an instance of Product, Folder, Content or Category Model */ - abstract function getObject(); + abstract public function getObject(); /** * @covers Thelia\Model\Tools\UrlRewritingTrait::generateRewrittenUrl @@ -105,4 +104,4 @@ abstract class BaseRewritingObject extends \PHPUnit_Framework_TestCase $object->generateRewrittenUrl('fr_FR'); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php b/core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php index 247fdc8a9..f5ff56685 100644 --- a/core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php +++ b/core/lib/Thelia/Tests/Rewriting/CategoryRewritingTest.php @@ -24,7 +24,6 @@ namespace Thelia\Tests\Rewriting; use Thelia\Model\Category; - /** * Class CategoryRewritingTest * @package Thelia\Tests\Rewriting @@ -36,8 +35,8 @@ class CategoryRewritingTest extends BaseRewritingObject /** * @return \Thelia\Model\Category */ - function getObject() + public function getObject() { return new Category(); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php b/core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php index e06ff62b2..97dd10bee 100644 --- a/core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php +++ b/core/lib/Thelia/Tests/Rewriting/ContentRewritingTest.php @@ -24,7 +24,6 @@ namespace Thelia\Tests\Rewriting; use Thelia\Model\Content; - /** * Class ContentRewritingTest * @package Thelia\Tests\Rewriting @@ -36,8 +35,8 @@ class ContentRewritingTest extends BaseRewritingObject /** * @return \Thelia\Model\Content */ - function getObject() + public function getObject() { return new Content(); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php b/core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php index db0dbc897..81e4154a2 100644 --- a/core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php +++ b/core/lib/Thelia/Tests/Rewriting/FolderRewritingTest.php @@ -24,7 +24,6 @@ namespace Thelia\Tests\Rewriting; use Thelia\Model\Folder; - /** * Class FolderRewritingTest * @package Thelia\Tests\Rewriting @@ -36,8 +35,8 @@ class FolderRewritingTest extends BaseRewritingObject /** * @return mixed an instance of Product, Folder, Content or Category Model */ - function getObject() + public function getObject() { return new Folder(); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php b/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php index 2bff1bf5c..0a74587d5 100644 --- a/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php +++ b/core/lib/Thelia/Tests/Rewriting/ProductRewriteTest.php @@ -23,8 +23,6 @@ namespace Thelia\Tests\Rewriting; use Thelia\Model\Product; -use Thelia\Model\ProductQuery; - /** * Class ProductRewriteTest @@ -37,8 +35,8 @@ class ProductRewriteTest extends BaseRewritingObject /** * @return mixed an instance of Product, Folder, Content or Category Model */ - function getObject() + public function getObject() { return new Product(); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tests/Tools/FileManagerTest.php b/core/lib/Thelia/Tests/Tools/FileManagerTest.php index 0bde45213..7ea43bb85 100644 --- a/core/lib/Thelia/Tests/Tools/FileManagerTest.php +++ b/core/lib/Thelia/Tests/Tools/FileManagerTest.php @@ -3,13 +3,12 @@ * Created by JetBrains PhpStorm. * Date: 9/18/13 * Time: 8:47 PM - * + * * @author Guillaume MOREL */ namespace Thelia\Tests\Type; - use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent; use Thelia\Core\Event\Image\ImageCreateOrUpdateEvent; use Thelia\Core\Translation\Translator; @@ -22,9 +21,8 @@ use Thelia\Tools\FileManager; * * @package Thelia\Tests\Type */ -class FileManagerTest extends \PHPUnit_Framework_TestCase { - - +class FileManagerTest extends \PHPUnit_Framework_TestCase +{ /** * @covers Thelia\Tools\FileManager::copyUploadedFile */ @@ -52,8 +50,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { ->method('getAdminUser') ->will($this->returnValue(new Admin())); - - // Create a map of arguments to return values. $map = array( array('thelia.translator', $stubTranslator), @@ -105,7 +101,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { $this->assertCount(1, $actual); } - /** * @covers Thelia\Tools\FileManager::copyUploadedFile * @expectedException \Thelia\Exception\ImageException @@ -134,8 +129,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { ->method('getAdminUser') ->will($this->returnValue(new Admin())); - - // Create a map of arguments to return values. $map = array( array('thelia.translator', $stubTranslator), @@ -745,7 +738,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(false, $actual); } - /** * @covers Thelia\Tools\FileManager::getFormId */ @@ -799,7 +791,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { ->method('getClientOriginalName') ->will($this->returnValue('or1-g_n?al*/&é"filen@me#')); - $fileManager = new FileManager($stubContainer); $expected = 'or1-g_nalfilenme-1.yml'; @@ -827,7 +818,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { ->method('getClientOriginalName') ->will($this->returnValue('or1-g_n?al*/&é"filen@me#')); - $fileManager = new FileManager($stubContainer); $expected = 'or1-g_nalfilenme-1'; @@ -865,7 +855,6 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase { } - /** * @covers Thelia\Tools\FileManager::getAvailableTypes */ diff --git a/core/lib/Thelia/Tools/FileManager.php b/core/lib/Thelia/Tools/FileManager.php index c3f5233b3..a795bcd5e 100644 --- a/core/lib/Thelia/Tools/FileManager.php +++ b/core/lib/Thelia/Tools/FileManager.php @@ -156,7 +156,7 @@ class FileManager * @param ImageCreateOrUpdateEvent $event Image event * @param FolderImage|ContentImage|CategoryImage|ProductImage $modelImage Image to save * - * @return int Nb lines modified + * @return int Nb lines modified * @throws \Thelia\Exception\ImageException * @todo refactor make all pictures using propel inheritance and factorise image behaviour into one single clean action */ @@ -215,7 +215,7 @@ class FileManager * @param FolderDocument|ContentDocument|CategoryDocument|ProductDocument $modelDocument Document to save * * @throws \Thelia\Model\Exception\InvalidArgumentException - * @return int Nb lines modified + * @return int Nb lines modified * @todo refactor make all documents using propel inheritance and factorise image behaviour into one single clean action */ public function saveDocument(DocumentCreateOrUpdateEvent $event, $modelDocument) @@ -296,7 +296,6 @@ class FileManager ); } - /** * Delete image from file storage and database * @@ -313,7 +312,6 @@ class FileManager $model->delete(); } - /** * Get image model from type * @@ -723,4 +721,4 @@ class FileManager self::TYPE_MODULE, ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Tools/I18n.php b/core/lib/Thelia/Tools/I18n.php index aeb79ca84..9931f4087 100644 --- a/core/lib/Thelia/Tools/I18n.php +++ b/core/lib/Thelia/Tools/I18n.php @@ -23,8 +23,6 @@ namespace Thelia\Tools; -use Propel\Runtime\ActiveQuery\ModelCriteria; -use Propel\Runtime\ActiveRecord\ActiveRecordInterface; use Thelia\Model\Lang; /** @@ -69,19 +67,19 @@ class I18n $askedLocale )->findOne(); /* or default translation */ - if(null === $i18n) { + if (null === $i18n) { $i18n = $i18nQueryClass::create() ->filterById($id) ->filterByLocale( Lang::getDefaultLanguage()->getLocale() )->findOne(); } - if(null === $i18n) { // @todo something else ? + if (null === $i18n) { // @todo something else ? $i18n = new $i18nClass();; $i18n->setId($id); - foreach($needed as $need) { + foreach ($needed as $need) { $method = sprintf('set%s', $need); - if(method_exists($i18n, $method)) { + if (method_exists($i18n, $method)) { $i18n->$method('DEFAULT ' . strtoupper($need)); } else { // @todo throw sg ? diff --git a/core/lib/Thelia/Tools/Image.php b/core/lib/Thelia/Tools/Image.php index 5fa4d3c6c..2558c9bd4 100755 --- a/core/lib/Thelia/Tools/Image.php +++ b/core/lib/Thelia/Tools/Image.php @@ -25,17 +25,16 @@ namespace Thelia\Tools; class Image { - static public function isImage($filePath, $allowedImageTypes = null) + public static function isImage($filePath, $allowedImageTypes = null) { $imageFile = getimagesize($filePath); $imageType = $imageFile[2]; - if(!is_array($allowedImageTypes) && $imageType != IMAGETYPE_UNKNOWN) { + if (!is_array($allowedImageTypes) && $imageType != IMAGETYPE_UNKNOWN) { return true; } - if(in_array($imageType , $allowedImageTypes)) - { + if (in_array($imageType , $allowedImageTypes)) { return true; } diff --git a/core/lib/Thelia/Tools/URL.php b/core/lib/Thelia/Tools/URL.php index 363860064..83469f602 100755 --- a/core/lib/Thelia/Tools/URL.php +++ b/core/lib/Thelia/Tools/URL.php @@ -91,6 +91,7 @@ class URL $schemeAuthority = "$scheme://$host"."$port"; } + return $schemeAuthority.$this->requestContext->getBaseUrl(); } @@ -240,7 +241,7 @@ class URL } else { $allParametersWithoutView = $request->query->all(); $view = $request->attributes->get('_view'); - if(isset($allOtherParameters['view'])) { + if (isset($allOtherParameters['view'])) { unset($allOtherParameters['view']); } $this->retriever->rewrittenUrl = null; diff --git a/core/lib/Thelia/Type/FloatToFloatArrayType.php b/core/lib/Thelia/Type/FloatToFloatArrayType.php index 5a70dba91..682ddebdd 100755 --- a/core/lib/Thelia/Type/FloatToFloatArrayType.php +++ b/core/lib/Thelia/Type/FloatToFloatArrayType.php @@ -38,10 +38,11 @@ class FloatToFloatArrayType implements TypeInterface public function isValid($value) { if(!is_array($value)) + return false; - foreach($value as $key => $value) { - if( filter_var($key, FILTER_VALIDATE_FLOAT) === false || filter_var($value, FILTER_VALIDATE_FLOAT) === false ) { + foreach ($value as $key => $value) { + if ( filter_var($key, FILTER_VALIDATE_FLOAT) === false || filter_var($value, FILTER_VALIDATE_FLOAT) === false ) { return false; } } diff --git a/core/lib/Thelia/Type/ModelType.php b/core/lib/Thelia/Type/ModelType.php index 38df857e4..9eacef094 100755 --- a/core/lib/Thelia/Type/ModelType.php +++ b/core/lib/Thelia/Type/ModelType.php @@ -42,7 +42,7 @@ class ModelType implements TypeInterface { $class = '\\Thelia\\Model\\' . $expectedModelActiveRecord; - if(!(class_exists($class) && new $class instanceof ActiveRecordInterface)) { + if (!(class_exists($class) && new $class instanceof ActiveRecordInterface)) { throw new TypeException('MODEL NOT FOUND', TypeException::MODEL_NOT_FOUND); }