From 2c030f910b49813a7412cd38d88e16dfec08ae7c Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Fri, 25 Oct 2013 10:07:21 +0200 Subject: [PATCH] fix cs --- core/lib/Thelia/Action/Administrator.php | 4 +- core/lib/Thelia/Action/Lang.php | 5 +- core/lib/Thelia/Action/Module.php | 2 +- core/lib/Thelia/Action/Newsletter.php | 7 +- core/lib/Thelia/Action/Product.php | 8 -- core/lib/Thelia/Action/ProductSaleElement.php | 23 ++---- core/lib/Thelia/Action/Profile.php | 5 +- core/lib/Thelia/Action/Tax.php | 1 - core/lib/Thelia/Action/TaxRule.php | 1 - core/lib/Thelia/Command/GenerateResources.php | 16 ++-- .../Admin/AbstractCrudController.php | 2 +- .../Admin/AdministratorController.php | 5 +- .../Controller/Admin/BaseAdminController.php | 6 +- .../Controller/Admin/CustomerController.php | 1 - .../Controller/Admin/LangController.php | 10 +-- .../Controller/Admin/LanguageController.php | 4 +- .../Admin/MailingSystemController.php | 4 +- .../Controller/Admin/MessageController.php | 1 - .../Controller/Admin/ModuleController.php | 6 +- .../Controller/Admin/ProductController.php | 70 ++++++++---------- .../Controller/Admin/ProfileController.php | 19 +++-- .../Thelia/Controller/Admin/TaxController.php | 12 ++- core/lib/Thelia/Controller/BaseController.php | 11 +-- .../Controller/Front/CartController.php | 1 - .../Controller/Front/ContactController.php | 5 +- .../Controller/Front/CouponController.php | 10 --- .../Controller/Front/CustomerController.php | 6 +- core/lib/Thelia/Controller/Front/Mail.php | 3 +- .../Controller/Front/NewsletterController.php | 8 +- .../Core/Event/Lang/LangCreateEvent.php | 4 +- .../Event/Lang/LangDefaultBehaviorEvent.php | 8 +- .../Core/Event/Lang/LangDeleteEvent.php | 5 +- core/lib/Thelia/Core/Event/Lang/LangEvent.php | 8 +- .../Event/Lang/LangToggleDefaultEvent.php | 7 +- .../Core/Event/Lang/LangUpdateEvent.php | 7 +- .../Core/Event/Module/ModuleDeleteEvent.php | 6 +- .../Core/Event/Newsletter/NewsletterEvent.php | 9 +-- .../ProductSaleElementCreateEvent.php | 8 +- .../ProductSaleElementDeleteEvent.php | 2 +- .../ProductSaleElementUpdateEvent.php | 3 +- core/lib/Thelia/Core/Event/TheliaEvents.php | 1 - core/lib/Thelia/Core/Form/Type/TheliaType.php | 2 +- .../Thelia/Core/Security/AccessManager.php | 22 ++---- .../Security/Exception/RessourceException.php | 2 +- .../Core/Security/Resource/AdminResources.php | 8 +- .../Thelia/Core/Security/SecurityContext.php | 17 ++--- .../Thelia/Core/Template/Element/BaseLoop.php | 11 ++- .../Template/Element/SearchLoopInterface.php | 2 - core/lib/Thelia/Core/Template/Loop/Admin.php | 2 - core/lib/Thelia/Core/Template/Loop/Cart.php | 9 +-- .../lib/Thelia/Core/Template/Loop/Content.php | 1 - .../Thelia/Core/Template/Loop/Customer.php | 6 +- core/lib/Thelia/Core/Template/Loop/Module.php | 2 +- core/lib/Thelia/Core/Template/Loop/Order.php | 7 +- .../lib/Thelia/Core/Template/Loop/Product.php | 14 ++-- .../lib/Thelia/Core/Template/Loop/Profile.php | 1 - .../Thelia/Core/Template/Loop/Resource.php | 3 +- .../Core/Template/Loop/TaxRuleCountry.php | 14 ++-- .../Thelia/Core/Template/ParserContext.php | 1 - .../Template/Smarty/AbstractSmartyPlugin.php | 2 +- .../Core/Template/Smarty/Plugins/Form.php | 45 +++++------- .../Core/Template/Smarty/SmartyParser.php | 1 - .../Thelia/Form/AdministratorCreationForm.php | 9 +-- .../Form/AdministratorModificationForm.php | 3 +- core/lib/Thelia/Form/ContactForm.php | 3 +- core/lib/Thelia/Form/CouponCode.php | 2 - core/lib/Thelia/Form/CouponCreationForm.php | 1 - .../Form/CustomerPasswordUpdateForm.php | 1 - .../Thelia/Form/CustomerProfilUpdateForm.php | 4 - core/lib/Thelia/Form/Lang/LangCreateForm.php | 3 +- .../Form/Lang/LangDefaultBehaviorForm.php | 4 +- core/lib/Thelia/Form/Lang/LangUpdateForm.php | 3 +- core/lib/Thelia/Form/Lang/LangUrlEvent.php | 3 +- core/lib/Thelia/Form/Lang/LangUrlForm.php | 3 +- core/lib/Thelia/Form/NewsletterForm.php | 3 +- .../ProductDefaultSaleElementUpdateForm.php | 2 +- .../Form/ProfileUpdateModuleAccessForm.php | 3 +- .../Form/ProfileUpdateResourceAccessForm.php | 3 +- core/lib/Thelia/Form/TaxCreationForm.php | 6 +- core/lib/Thelia/Module/BaseModule.php | 3 +- .../Tests/Coupon/CouponBaseAdapterTest.php | 47 ------------ .../Thelia/Tests/Coupon/CouponFactoryTest.php | 48 ------------ .../Thelia/Tests/Coupon/CouponManagerTest.php | 48 ------------ .../Tests/Coupon/CouponRuleCollectionTest.php | 46 ------------ .../Thelia/Tests/Coupon/RuleOrganizerTest.php | 73 ------------------- .../Tests/Coupon/Type/RemoveXAmountTest.php | 65 ----------------- .../Tests/Coupon/Type/RemoveXPercentTest.php | 67 ----------------- .../Thelia/Tests/Tools/FileManagerTest.php | 24 +++--- core/lib/Thelia/Tools/NumberFormat.php | 3 +- core/lib/Thelia/Type/BaseType.php | 2 +- core/lib/Thelia/Type/ModelValidIdType.php | 2 +- 91 files changed, 219 insertions(+), 761 deletions(-) delete mode 100644 core/lib/Thelia/Tests/Coupon/CouponBaseAdapterTest.php delete mode 100644 core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php delete mode 100644 core/lib/Thelia/Tests/Coupon/CouponManagerTest.php delete mode 100644 core/lib/Thelia/Tests/Coupon/CouponRuleCollectionTest.php delete mode 100644 core/lib/Thelia/Tests/Coupon/RuleOrganizerTest.php delete mode 100644 core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php delete mode 100644 core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php diff --git a/core/lib/Thelia/Action/Administrator.php b/core/lib/Thelia/Action/Administrator.php index 0f3891e15..2bbfce8a8 100644 --- a/core/lib/Thelia/Action/Administrator.php +++ b/core/lib/Thelia/Action/Administrator.php @@ -23,11 +23,9 @@ namespace Thelia\Action; -use Propel\Runtime\ActiveQuery\Criteria; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Thelia\Core\Event\Administrator\AdministratorEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Core\Security\AccessManager; use Thelia\Model\Admin as AdminModel; use Thelia\Model\AdminQuery; @@ -69,7 +67,7 @@ class Administrator extends BaseAction implements EventSubscriberInterface ->setProfileId($event->getProfile()) ; - if('' !== $event->getPassword()) { + if ('' !== $event->getPassword()) { $administrator->setPassword($event->getPassword()); } diff --git a/core/lib/Thelia/Action/Lang.php b/core/lib/Thelia/Action/Lang.php index 1c74da3bd..3acb62b29 100644 --- a/core/lib/Thelia/Action/Lang.php +++ b/core/lib/Thelia/Action/Lang.php @@ -34,7 +34,6 @@ use Thelia\Model\ConfigQuery; use Thelia\Model\LangQuery; use Thelia\Model\Lang as LangModel; - /** * Class Lang * @package Thelia\Action @@ -105,7 +104,7 @@ class Lang extends BaseAction implements EventSubscriberInterface public function langUrl(LangUrlEvent $event) { - foreach($event->getUrl() as $id => $url){ + foreach ($event->getUrl() as $id => $url) { LangQuery::create() ->filterById($id) ->update(array('Url' => $url)); @@ -143,4 +142,4 @@ class Lang extends BaseAction implements EventSubscriberInterface TheliaEvents::LANG_URL => array('langUrl', 128) ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/Module.php b/core/lib/Thelia/Action/Module.php index ddc285960..a994288d9 100644 --- a/core/lib/Thelia/Action/Module.php +++ b/core/lib/Thelia/Action/Module.php @@ -70,7 +70,7 @@ class Module extends BaseAction implements EventSubscriberInterface $con->beginTransaction(); try { - if(null === $module->getFullNamespace()) { + if (null === $module->getFullNamespace()) { throw new \LogicException('can not instanciante this module if namespace is null. Maybe the model is not loaded ?'); } diff --git a/core/lib/Thelia/Action/Newsletter.php b/core/lib/Thelia/Action/Newsletter.php index fe489e120..aeb26f3d6 100644 --- a/core/lib/Thelia/Action/Newsletter.php +++ b/core/lib/Thelia/Action/Newsletter.php @@ -29,7 +29,6 @@ use Thelia\Action\BaseAction; use Thelia\Model\NewsletterQuery; use Thelia\Model\Newsletter as NewsletterModel; - /** * Class Newsletter * @package Thelia\Action @@ -52,14 +51,14 @@ class Newsletter extends BaseAction implements EventSubscriberInterface public function unsubscribe(NewsletterEvent $event) { - if(null !== $nl = NewsletterQuery::create()->findPk($event->getId())) { + if (null !== $nl = NewsletterQuery::create()->findPk($event->getId())) { $nl->delete(); } } public function update(NewsletterEvent $event) { - if(null !== $nl = NewsletterQuery::create()->findPk($event->getId())) { + if (null !== $nl = NewsletterQuery::create()->findPk($event->getId())) { $nl->setEmail($event->getEmail()) ->setFirstname($event->getFirstname()) ->setLastname($event->getLastname()) @@ -96,4 +95,4 @@ class Newsletter extends BaseAction implements EventSubscriberInterface TheliaEvents::NEWSLETTER_UNSUBSCRIBE => array('unsubscribe', 128) ); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Action/Product.php b/core/lib/Thelia/Action/Product.php index e82b92bf6..e56df6523 100644 --- a/core/lib/Thelia/Action/Product.php +++ b/core/lib/Thelia/Action/Product.php @@ -52,14 +52,6 @@ use Thelia\Core\Event\Product\ProductSetTemplateEvent; use Thelia\Model\ProductSaleElementsQuery; use Thelia\Core\Event\Product\ProductDeleteCategoryEvent; use Thelia\Core\Event\Product\ProductAddCategoryEvent; -use Thelia\Model\AttributeAvQuery; -use Thelia\Model\AttributeCombination; -use Thelia\Core\Event\Product\ProductSaleElementCreateEvent; -use Propel\Runtime\Propel; -use Thelia\Model\Map\ProductTableMap; -use Thelia\Core\Event\Product\ProductSaleElementDeleteEvent; -use Thelia\Model\ProductPrice; -use Thelia\Model\ProductSaleElements; use Thelia\Core\Event\Product\ProductAddAccessoryEvent; use Thelia\Core\Event\Product\ProductDeleteAccessoryEvent; diff --git a/core/lib/Thelia/Action/ProductSaleElement.php b/core/lib/Thelia/Action/ProductSaleElement.php index d3c34c293..8349eb1bf 100644 --- a/core/lib/Thelia/Action/ProductSaleElement.php +++ b/core/lib/Thelia/Action/ProductSaleElement.php @@ -25,9 +25,6 @@ namespace Thelia\Action; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Thelia\Model\ProductQuery; -use Thelia\Model\Product as ProductModel; - use Thelia\Core\Event\TheliaEvents; use Thelia\Core\Event\ProductSaleElement\ProductSaleElementCreateEvent; use Thelia\Model\Map\ProductSaleElementsTableMap; @@ -49,7 +46,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface /** * Create a new product sale element, with or without combination * - * @param ProductSaleElementCreateEvent $event + * @param ProductSaleElementCreateEvent $event * @throws Exception */ public function create(ProductSaleElementCreateEvent $event) @@ -69,8 +66,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface if ($salesElement == null) { // Create a new default product sale element $salesElement = $event->getProduct()->createDefaultProductSaleElement($con, 0, 0, $event->getCurrencyId(), true); - } - else { + } else { // This (new) one is the default $salesElement->setIsDefault(true)->save($con); } @@ -98,8 +94,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface // Store all the stuff ! $con->commit(); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { $con->rollback(); @@ -170,8 +165,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface ->setPromoPrice($event->getSalePrice()) ->setPrice($event->getPrice()) ; - } - else { + } else { // Do not store the price. $productPrice ->setPromoPrice(0) @@ -183,8 +177,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface // Store all the stuff ! $con->commit(); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { $con->rollback(); @@ -214,8 +207,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface if ($product->countSaleElements() <= 0) { // If we just deleted the last PSE, create a default one $product->createDefaultProductSaleElement($con, 0, 0, $event->getCurrencyId(), true); - } - else if ($pse->getIsDefault()) { + } elseif ($pse->getIsDefault()) { // If we deleted the default PSE, make the last created one the default $pse = ProductSaleElementsQuery::create() @@ -229,8 +221,7 @@ class ProductSaleElement extends BaseAction implements EventSubscriberInterface // Store all the stuff ! $con->commit(); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { $con->rollback(); diff --git a/core/lib/Thelia/Action/Profile.php b/core/lib/Thelia/Action/Profile.php index 544882700..a35a0d250 100644 --- a/core/lib/Thelia/Action/Profile.php +++ b/core/lib/Thelia/Action/Profile.php @@ -23,7 +23,6 @@ namespace Thelia\Action; -use Propel\Runtime\ActiveQuery\Criteria; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Thelia\Core\Event\Profile\ProfileEvent; use Thelia\Core\Event\TheliaEvents; @@ -90,7 +89,7 @@ class Profile extends BaseAction implements EventSubscriberInterface { if (null !== $profile = ProfileQuery::create()->findPk($event->getId())) { ProfileResourceQuery::create()->filterByProfileId($event->getId())->delete(); - foreach($event->getResourceAccess() as $resourceCode => $accesses) { + foreach ($event->getResourceAccess() as $resourceCode => $accesses) { $manager = new AccessManager(0); $manager->build($accesses); @@ -114,7 +113,7 @@ class Profile extends BaseAction implements EventSubscriberInterface { if (null !== $profile = ProfileQuery::create()->findPk($event->getId())) { ProfileModuleQuery::create()->filterByProfileId($event->getId())->delete(); - foreach($event->getModuleAccess() as $moduleCode => $accesses) { + foreach ($event->getModuleAccess() as $moduleCode => $accesses) { $manager = new AccessManager(0); $manager->build($accesses); diff --git a/core/lib/Thelia/Action/Tax.php b/core/lib/Thelia/Action/Tax.php index c35d87bbe..5189bf9db 100644 --- a/core/lib/Thelia/Action/Tax.php +++ b/core/lib/Thelia/Action/Tax.php @@ -23,7 +23,6 @@ namespace Thelia\Action; -use Propel\Runtime\ActiveQuery\Criteria; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Thelia\Core\Event\Tax\TaxEvent; use Thelia\Core\Event\TheliaEvents; diff --git a/core/lib/Thelia/Action/TaxRule.php b/core/lib/Thelia/Action/TaxRule.php index e6d42976e..a5368a400 100644 --- a/core/lib/Thelia/Action/TaxRule.php +++ b/core/lib/Thelia/Action/TaxRule.php @@ -27,7 +27,6 @@ use Propel\Runtime\ActiveQuery\Criteria; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Thelia\Core\Event\Tax\TaxRuleEvent; use Thelia\Core\Event\TheliaEvents; -use Thelia\Model\Map\TaxRuleTableMap; use Thelia\Model\TaxRuleCountry; use Thelia\Model\TaxRuleCountryQuery; use Thelia\Model\TaxRule as TaxRuleModel; diff --git a/core/lib/Thelia/Command/GenerateResources.php b/core/lib/Thelia/Command/GenerateResources.php index fcad56b41..124648b2a 100644 --- a/core/lib/Thelia/Command/GenerateResources.php +++ b/core/lib/Thelia/Command/GenerateResources.php @@ -61,19 +61,19 @@ class GenerateResources extends ContainerAwareCommand $constants = $class->getConstants(); - if(count($constants) == 0) { + if (count($constants) == 0) { $output->writeln('No resources found'); exit; } - switch($input->getOption("output")) { + switch ($input->getOption("output")) { case 'sql': $output->writeln( 'INSERT INTO ' . ResourceTableMap::TABLE_NAME . ' (`id`, `code`, `created_at`, `updated_at`) VALUES ' ); $compteur = 0; - foreach($constants as $constant => $value) { - if($constant == AdminResources::SUPERADMINISTRATOR) { + foreach ($constants as $constant => $value) { + if ($constant == AdminResources::SUPERADMINISTRATOR) { continue; } $compteur++; @@ -87,8 +87,8 @@ class GenerateResources extends ContainerAwareCommand 'INSERT INTO ' . ResourceI18nTableMap::TABLE_NAME . ' (`id`, `locale`, `title`) VALUES ' ); $compteur = 0; - foreach($constants as $constant => $value) { - if($constant == AdminResources::SUPERADMINISTRATOR) { + foreach ($constants as $constant => $value) { + if ($constant == AdminResources::SUPERADMINISTRATOR) { continue; } @@ -105,8 +105,8 @@ class GenerateResources extends ContainerAwareCommand } break; default : - foreach($constants as $constant => $value) { - if($constant == AdminResources::SUPERADMINISTRATOR) { + foreach ($constants as $constant => $value) { + if ($constant == AdminResources::SUPERADMINISTRATOR) { continue; } $output->writeln('[' . $constant . "] => " . $value); diff --git a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php index 114bd75c1..e38e08a7a 100644 --- a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php +++ b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php @@ -56,7 +56,7 @@ abstract class AbstractCrudController extends BaseAdminController * @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 $resourceCode the 'resource' code. Example: "admin.configuration.message" + * @param string $resourceCode the 'resource' code. Example: "admin.configuration.message" * * @param string $createEventIdentifier the dispatched create TheliaEvent identifier. Example: TheliaEvents::MESSAGE_CREATE * @param string $updateEventIdentifier the dispatched update TheliaEvent identifier. Example: TheliaEvents::MESSAGE_UPDATE diff --git a/core/lib/Thelia/Controller/Admin/AdministratorController.php b/core/lib/Thelia/Controller/Admin/AdministratorController.php index 10780037a..214d4cd7a 100644 --- a/core/lib/Thelia/Controller/Admin/AdministratorController.php +++ b/core/lib/Thelia/Controller/Admin/AdministratorController.php @@ -23,7 +23,6 @@ namespace Thelia\Controller\Admin; -use Thelia\Core\Security\AccessManager; use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Event\Administrator\AdministratorEvent; use Thelia\Core\Event\TheliaEvents; @@ -31,7 +30,6 @@ use Thelia\Form\AdministratorCreationForm; use Thelia\Form\AdministratorModificationForm; use Thelia\Model\AdminQuery; - class AdministratorController extends AbstractCrudController { public function __construct() @@ -158,7 +156,6 @@ class AdministratorController extends AbstractCrudController return $object->getId(); } - protected function renderListTemplate($currentOrder) { // We always return to the feature edition form @@ -198,4 +195,4 @@ class AdministratorController extends AbstractCrudController "admin.configuration.administrators.view" ); } -} \ 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 be6deca15..e4d9550d3 100755 --- a/core/lib/Thelia/Controller/Admin/BaseAdminController.php +++ b/core/lib/Thelia/Controller/Admin/BaseAdminController.php @@ -115,7 +115,7 @@ class BaseAdminController extends BaseController * Check current admin user authorisations. An ADMIN role is assumed. * * @param mixed $resources a single resource or an array of resources. - * @param mixed $accesses a single access or an array of accesses. + * @param mixed $accesses a single access or an array of accesses. * * @return mixed null if authorization is granted, or a Response object which contains the error page otherwise * @@ -369,8 +369,8 @@ class BaseAdminController extends BaseController * Render the given template, and returns the result as an Http Response. * * @param $templateName the complete template name, with extension - * @param array $args the template arguments - * @param int $status http code status + * @param array $args the template arguments + * @param int $status http code status * @return \Symfony\Component\HttpFoundation\Response */ protected function render($templateName, $args = array(), $status = 200) diff --git a/core/lib/Thelia/Controller/Admin/CustomerController.php b/core/lib/Thelia/Controller/Admin/CustomerController.php index 7f8cd8615..df75333c8 100644 --- a/core/lib/Thelia/Controller/Admin/CustomerController.php +++ b/core/lib/Thelia/Controller/Admin/CustomerController.php @@ -25,7 +25,6 @@ namespace Thelia\Controller\Admin; use Propel\Runtime\Exception\PropelException; use Thelia\Core\Security\Resource\AdminResources; -use Thelia\Core\Event\Customer\CustomerAddressEvent; use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent; use Thelia\Core\Event\Customer\CustomerEvent; use Thelia\Core\Event\TheliaEvents; diff --git a/core/lib/Thelia/Controller/Admin/LangController.php b/core/lib/Thelia/Controller/Admin/LangController.php index 9b6074955..8e0ca5d1c 100644 --- a/core/lib/Thelia/Controller/Admin/LangController.php +++ b/core/lib/Thelia/Controller/Admin/LangController.php @@ -41,7 +41,6 @@ use Thelia\Form\Lang\LangUrlForm; use Thelia\Model\ConfigQuery; use Thelia\Model\LangQuery; - /** * Class LangController * @package Thelia\Controller\Admin @@ -53,7 +52,6 @@ class LangController extends BaseAdminController public function defaultAction() { if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::VIEW)) return $response; - return $this->renderDefault(); } @@ -120,7 +118,7 @@ class LangController extends BaseAdminController $changedObject = $event->getLang(); $this->adminLogAppend(sprintf("%s %s (ID %s) modified", 'Lang', $changedObject->getTitle(), $changedObject->getId())); $this->redirectToRoute('/admin/configuration/languages'); - } catch(\Exception $e) { + } catch (\Exception $e) { $error_msg = $e->getMessage(); } @@ -162,7 +160,7 @@ class LangController extends BaseAdminController $error = $e->getMessage(); } - if($error) { + if ($error) { return $this->nullResponse(500); } else { return $this->nullResponse(); @@ -281,7 +279,7 @@ class LangController extends BaseAdminController $event = new LangUrlEvent(); foreach ($data as $key => $value) { $pos= strpos($key, LangUrlForm::LANG_PREFIX); - if(false !== strpos($key, LangUrlForm::LANG_PREFIX)) { + if (false !== strpos($key, LangUrlForm::LANG_PREFIX)) { $event->addUrl(substr($key,strlen(LangUrlForm::LANG_PREFIX)), $value); } } @@ -326,4 +324,4 @@ class LangController extends BaseAdminController $this->redirectToRoute('admin.configuration.languages'); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/LanguageController.php b/core/lib/Thelia/Controller/Admin/LanguageController.php index 834a4cbed..7559cb5cc 100644 --- a/core/lib/Thelia/Controller/Admin/LanguageController.php +++ b/core/lib/Thelia/Controller/Admin/LanguageController.php @@ -38,5 +38,5 @@ class LanguageController extends BaseAdminController if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::VIEW)) return $response; return $this->render("languages"); } - -} \ No newline at end of file + +} diff --git a/core/lib/Thelia/Controller/Admin/MailingSystemController.php b/core/lib/Thelia/Controller/Admin/MailingSystemController.php index dba5d2417..5bf2f4e73 100644 --- a/core/lib/Thelia/Controller/Admin/MailingSystemController.php +++ b/core/lib/Thelia/Controller/Admin/MailingSystemController.php @@ -38,5 +38,5 @@ class MailingSystemController extends BaseAdminController if (null !== $response = $this->checkAuth(AdminResources::MAILING_SYSTEM, AccessManager::VIEW)) return $response; return $this->render("mailing-system"); } - -} \ No newline at end of file + +} diff --git a/core/lib/Thelia/Controller/Admin/MessageController.php b/core/lib/Thelia/Controller/Admin/MessageController.php index e85e9267d..407578a08 100644 --- a/core/lib/Thelia/Controller/Admin/MessageController.php +++ b/core/lib/Thelia/Controller/Admin/MessageController.php @@ -47,7 +47,6 @@ class MessageController extends AbstractCrudController AdminResources::MESSAGE, - TheliaEvents::MESSAGE_CREATE, TheliaEvents::MESSAGE_UPDATE, TheliaEvents::MESSAGE_DELETE, diff --git a/core/lib/Thelia/Controller/Admin/ModuleController.php b/core/lib/Thelia/Controller/Admin/ModuleController.php index 44a1c2a24..53322949a 100644 --- a/core/lib/Thelia/Controller/Admin/ModuleController.php +++ b/core/lib/Thelia/Controller/Admin/ModuleController.php @@ -41,7 +41,7 @@ class ModuleController extends BaseAdminController public function indexAction() { if (null !== $response = $this->checkAuth(AdminResources::MODULE, AccessManager::VIEW)) return $response; - + $modulemanagement = new ModuleManagement(); $modulemanagement->updateModules(); @@ -100,7 +100,7 @@ class ModuleController extends BaseAdminController $this->dispatch(TheliaEvents::MODULE_DELETE, $deleteEvent); - if($deleteEvent->hasModule() === false) { + if ($deleteEvent->hasModule() === false) { throw new \LogicException( $this->getTranslator()->trans("No %obj was updated.", array('%obj' => 'Module'))); } @@ -110,7 +110,7 @@ class ModuleController extends BaseAdminController $message = $e->getMessage(); } - if($message) { + if ($message) { return $this->render("modules", array( "error_message" => $message )); diff --git a/core/lib/Thelia/Controller/Admin/ProductController.php b/core/lib/Thelia/Controller/Admin/ProductController.php index fb93e3c01..84e16815d 100644 --- a/core/lib/Thelia/Controller/Admin/ProductController.php +++ b/core/lib/Thelia/Controller/Admin/ProductController.php @@ -54,7 +54,6 @@ use Thelia\Core\Event\ProductSaleElement\ProductSaleElementCreateEvent; use Thelia\Model\AttributeQuery; use Thelia\Model\AttributeAvQuery; use Thelia\Form\ProductSaleElementUpdateForm; -use Thelia\Model\ProductSaleElements; use Thelia\Model\ProductPriceQuery; use Thelia\Form\ProductDefaultSaleElementUpdateForm; use Thelia\Model\ProductPrice; @@ -62,8 +61,6 @@ use Thelia\Model\Currency; use Symfony\Component\HttpFoundation\JsonResponse; use Thelia\TaxEngine\Calculator; use Thelia\Model\Country; -use Thelia\Model\CountryQuery; -use Thelia\Model\TaxRuleQuery; use Thelia\Tools\NumberFormat; use Thelia\Model\Product; use Thelia\Model\CurrencyQuery; @@ -189,8 +186,8 @@ class ProductController extends AbstractCrudController return $event->hasProduct(); } - protected function updatePriceFromDefaultCurrency($productPrice, $saleElement, $defaultCurrency, $currentCurrency) { - + protected function updatePriceFromDefaultCurrency($productPrice, $saleElement, $defaultCurrency, $currentCurrency) + { // Get price for default currency $priceForDefaultCurrency = ProductPriceQuery::create() ->filterByCurrency($defaultCurrency) @@ -206,7 +203,8 @@ class ProductController extends AbstractCrudController } } - protected function appendValue(&$array, $key, $value) { + protected function appendValue(&$array, $key, $value) + { if (! isset($array[$key])) $array[$key] = array(); $array[$key][] = $value; @@ -228,7 +226,7 @@ class ProductController extends AbstractCrudController "tax_rule" => $object->getTaxRuleId() ); - foreach($saleElements as $saleElement) { + foreach ($saleElements as $saleElement) { // Get the product price for the current currency $productPrice = ProductPriceQuery::create() @@ -277,8 +275,7 @@ class ProductController extends AbstractCrudController "isdefault" => $saleElement->getIsDefault() > 0 ? 1 : 0, "ean_code" => $saleElement->getEanCode() ); - } - else { + } else { if ($saleElement->getIsDefault()) { $combinationPseData['default_pse'] = $saleElement->getId(); @@ -871,8 +868,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_ADD_PRODUCT_SALE_ELEMENT, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -895,8 +891,7 @@ class ProductController extends AbstractCrudController try { $this->dispatch(TheliaEvents::PRODUCT_DELETE_PRODUCT_SALE_ELEMENT, $event); - } - catch (\Exception $ex) { + } catch (\Exception $ex) { // Any error return $this->errorPage($ex); } @@ -907,7 +902,7 @@ class ProductController extends AbstractCrudController /** * Process a single PSE update, using form data array. * - * @param array $data the form data + * @param array $data the form data * @throws Exception is someting goes wrong. */ protected function processSingleProductSaleElementUpdate($data) @@ -969,7 +964,7 @@ class ProductController extends AbstractCrudController $count = count($data['product_sale_element_id']); - for($idx = 0; $idx < $count; $idx++) { + for ($idx = 0; $idx < $count; $idx++) { $tmp_data['product_sale_element_id'] = $pse_id = $data['product_sale_element_id'][$idx]; $tmp_data['reference'] = $data['reference'][$idx]; $tmp_data['price'] = $data['price'][$idx]; @@ -983,8 +978,7 @@ class ProductController extends AbstractCrudController $this->processSingleProductSaleElementUpdate($tmp_data); } - } - else { + } else { // No need to preprocess data $this->processSingleProductSaleElementUpdate($data); } @@ -996,12 +990,10 @@ class ProductController extends AbstractCrudController // Redirect to the success URL $this->redirect($changeForm->getSuccessUrl()); - } - 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(); } @@ -1016,7 +1008,8 @@ class ProductController extends AbstractCrudController /** * Process the change of product's PSE list. */ - public function updateProductSaleElementsAction() { + public function updateProductSaleElementsAction() + { return $this->processProductSaleElementUpdate( new ProductSaleElementUpdateForm($this->getRequest()) ); @@ -1025,7 +1018,8 @@ class ProductController extends AbstractCrudController /** * Update default product sale element (not attached to any combination) */ - public function updateProductDefaultSaleElementAction() { + public function updateProductDefaultSaleElementAction() + { return $this->processProductSaleElementUpdate( new ProductDefaultSaleElementUpdateForm($this->getRequest()) ); @@ -1035,8 +1029,8 @@ class ProductController extends AbstractCrudController * Invoked through Ajax; this method calculates the taxed price from the unaxed price, and * vice versa. */ - public function priceCaclulator() { - + public function priceCaclulator() + { $return_price = 0; $price = floatval($this->getRequest()->get('price', 0)); @@ -1048,11 +1042,9 @@ class ProductController extends AbstractCrudController if ($action == 'to_tax') { $return_price = $this->computePrice($price, 'without_tax', $product); - } - else if ($action == 'from_tax') { + } elseif ($action == 'from_tax') { $return_price = $this->computePrice($price, 'with_tax', $product); - } - else { + } else { $return_price = $price; } @@ -1069,8 +1061,8 @@ class ProductController extends AbstractCrudController * * @return \Symfony\Component\HttpFoundation\JsonResponse */ - public function loadConvertedPrices() { - + public function loadConvertedPrices() + { $product_sale_element_id = intval($this->getRequest()->get('product_sale_element_id', 0)); $currency_id = intval($this->getRequest()->get('currency_id', 0)); @@ -1114,13 +1106,13 @@ class ProductController extends AbstractCrudController /** * Calculate taxed/untexted price for a product * - * @param unknown $price - * @param unknown $price_type - * @param Product $product + * @param unknown $price + * @param unknown $price_type + * @param Product $product * @return Ambigous */ - protected function computePrice($price, $price_type, Product $product, $convert = false) { - + protected function computePrice($price, $price_type, Product $product, $convert = false) + { $calc = new Calculator(); $calc->load( @@ -1130,11 +1122,9 @@ class ProductController extends AbstractCrudController if ($price_type == 'without_tax') { $return_price = $calc->getTaxedPrice($price); - } - else if ($price_type == 'with_tax') { + } elseif ($price_type == 'with_tax') { $return_price = $calc->getUntaxedPrice($price); - } - else { + } else { $return_price = $price; } diff --git a/core/lib/Thelia/Controller/Admin/ProfileController.php b/core/lib/Thelia/Controller/Admin/ProfileController.php index 774570139..9db4e9315 100644 --- a/core/lib/Thelia/Controller/Admin/ProfileController.php +++ b/core/lib/Thelia/Controller/Admin/ProfileController.php @@ -29,7 +29,6 @@ use Thelia\Core\Event\Profile\ProfileEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Form\ProfileCreationForm; use Thelia\Form\ProfileModificationForm; -use Thelia\Form\ProfileProfileListUpdateForm; use Thelia\Form\ProfileUpdateModuleAccessForm; use Thelia\Form\ProfileUpdateResourceAccessForm; use Thelia\Model\ProfileQuery; @@ -201,8 +200,8 @@ class ProfileController extends AbstractCrudController /** * Put in this method post object creation processing if required. * - * @param ProfileEvent $createEvent the create event - * @return Response a response, or null to continue normal processing + * @param ProfileEvent $createEvent the create event + * @return Response a response, or null to continue normal processing */ protected function performAdditionalCreateAction($createEvent) { @@ -263,8 +262,8 @@ class ProfileController extends AbstractCrudController protected function getResourceAccess($formData) { $requirements = array(); - foreach($formData as $data => $value) { - if(!strstr($data, ':')) { + foreach ($formData as $data => $value) { + if (!strstr($data, ':')) { continue; } @@ -272,7 +271,7 @@ class ProfileController extends AbstractCrudController $prefix = array_shift ( $explosion ); - if($prefix != ProfileUpdateResourceAccessForm::RESOURCE_ACCESS_FIELD_PREFIX) { + if ($prefix != ProfileUpdateResourceAccessForm::RESOURCE_ACCESS_FIELD_PREFIX) { continue; } @@ -285,8 +284,8 @@ class ProfileController extends AbstractCrudController protected function getModuleAccess($formData) { $requirements = array(); - foreach($formData as $data => $value) { - if(!strstr($data, ':')) { + foreach ($formData as $data => $value) { + if (!strstr($data, ':')) { continue; } @@ -294,7 +293,7 @@ class ProfileController extends AbstractCrudController $prefix = array_shift ( $explosion ); - if($prefix != ProfileUpdateModuleAccessForm::MODULE_ACCESS_FIELD_PREFIX) { + if ($prefix != ProfileUpdateModuleAccessForm::MODULE_ACCESS_FIELD_PREFIX) { continue; } @@ -401,4 +400,4 @@ class ProfileController extends AbstractCrudController // At this point, the form has errors, and should be redisplayed. return $this->renderEditionTemplate(); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Admin/TaxController.php b/core/lib/Thelia/Controller/Admin/TaxController.php index fe472c796..96b6a4d5b 100644 --- a/core/lib/Thelia/Controller/Admin/TaxController.php +++ b/core/lib/Thelia/Controller/Admin/TaxController.php @@ -28,7 +28,6 @@ use Thelia\Core\Event\Tax\TaxEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Form\TaxCreationForm; use Thelia\Form\TaxModificationForm; -use Thelia\Form\TaxTaxListUpdateForm; use Thelia\Model\TaxQuery; class TaxController extends AbstractCrudController @@ -177,7 +176,7 @@ class TaxController extends AbstractCrudController /** * Put in this method post object creation processing if required. * - * @param TaxEvent $createEvent the create event + * @param TaxEvent $createEvent the create event * @return Response a response, or null to continue normal processing */ protected function performAdditionalCreateAction($createEvent) @@ -200,20 +199,19 @@ class TaxController extends AbstractCrudController { $type = $formData['type']; - } protected function getRequirements($type, $formData) { $requirements = array(); - foreach($formData as $data => $value) { - if(!strstr($data, ':')) { + foreach ($formData as $data => $value) { + if (!strstr($data, ':')) { continue; } $couple = explode(':', $data); - if(count($couple) != 2 || $couple[0] != $type) { + if (count($couple) != 2 || $couple[0] != $type) { continue; } @@ -222,4 +220,4 @@ class TaxController extends AbstractCrudController return $requirements; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php index 066958025..4bfc3c65f 100755 --- a/core/lib/Thelia/Controller/BaseController.php +++ b/core/lib/Thelia/Controller/BaseController.php @@ -57,7 +57,7 @@ class BaseController extends ContainerAware /** * Return an empty response (after an ajax request, for example) - * @param int $status + * @param int $status * @return \Symfony\Component\HttpFoundation\Response */ protected function nullResponse($status = 200) @@ -196,15 +196,13 @@ class BaseController extends ContainerAware $errorMessage = null; if ($form->get("error_message")->getData() != null) { $errorMessage = $form->get("error_message")->getData(); - } - else { + } else { $errorMessage = sprintf("Missing or invalid data: %s", $this->getErrorMessages($form)); } throw new FormValidationException($errorMessage); } - } - else { + } else { throw new FormValidationException(sprintf("Wrong form method, %s expected.", $expectedMethod)); } } @@ -229,8 +227,7 @@ class BaseController extends ContainerAware { if ($form != null) { $url = $form->getSuccessUrl(); - } - else { + } else { $url = $this->getRequest()->get("success_url"); } diff --git a/core/lib/Thelia/Controller/Front/CartController.php b/core/lib/Thelia/Controller/Front/CartController.php index 5ba8fed48..a2b92508c 100755 --- a/core/lib/Thelia/Controller/Front/CartController.php +++ b/core/lib/Thelia/Controller/Front/CartController.php @@ -67,7 +67,6 @@ class CartController extends BaseFrontController $request->attributes->set('_view', "includes/mini-cart"); } - if ($message) { $cartAdd->setErrorMessage($message); $this->getParserContext()->addForm($cartAdd); diff --git a/core/lib/Thelia/Controller/Front/ContactController.php b/core/lib/Thelia/Controller/Front/ContactController.php index da8c7efc2..7fa965921 100644 --- a/core/lib/Thelia/Controller/Front/ContactController.php +++ b/core/lib/Thelia/Controller/Front/ContactController.php @@ -26,7 +26,6 @@ use Thelia\Form\ContactForm; use Thelia\Form\Exception\FormValidationException; use Thelia\Model\ConfigQuery; - /** * Class ContactController * @package Thelia\Controller\Front @@ -53,7 +52,7 @@ class ContactController extends BaseFrontController $this->getMailer()->send($message); - } catch(FormValidationException $e) { + } catch (FormValidationException $e) { $error_message = $e->getMessage(); } @@ -70,4 +69,4 @@ class ContactController extends BaseFrontController $this->redirectToRoute('contact.success'); } } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Front/CouponController.php b/core/lib/Thelia/Controller/Front/CouponController.php index dd0e6d722..e74c14f31 100755 --- a/core/lib/Thelia/Controller/Front/CouponController.php +++ b/core/lib/Thelia/Controller/Front/CouponController.php @@ -24,21 +24,11 @@ namespace Thelia\Controller\Front; use Propel\Runtime\Exception\PropelException; use Thelia\Core\Event\Coupon\CouponConsumeEvent; -use Thelia\Exception\TheliaProcessException; use Thelia\Form\CouponCode; use Thelia\Form\Exception\FormValidationException; -use Thelia\Core\Event\Order\OrderEvent; use Thelia\Core\Event\TheliaEvents; -use Symfony\Component\HttpFoundation\Request; -use Thelia\Form\OrderDelivery; -use Thelia\Form\OrderPayment; use Thelia\Log\Tlog; -use Thelia\Model\AddressQuery; -use Thelia\Model\AreaDeliveryModuleQuery; -use Thelia\Model\Base\OrderQuery; -use Thelia\Model\ModuleQuery; use Thelia\Model\Order; -use Thelia\Tools\URL; /** * Class CouponController diff --git a/core/lib/Thelia/Controller/Front/CustomerController.php b/core/lib/Thelia/Controller/Front/CustomerController.php index 23f2e0f30..f9ebde9e6 100755 --- a/core/lib/Thelia/Controller/Front/CustomerController.php +++ b/core/lib/Thelia/Controller/Front/CustomerController.php @@ -51,7 +51,6 @@ class CustomerController extends BaseFrontController { use \Thelia\Cart\CartTrait; - public function newPasswordAction() { if (! $this->getSecurityContext()->hasCustomerUser()) { @@ -156,7 +155,6 @@ class CustomerController extends BaseFrontController $this->getParserContext()->addForm($customerProfilUpdateForm); } - public function updatePasswordAction() { if ($this->getSecurityContext()->hasCustomerUser()) { @@ -220,14 +218,14 @@ class CustomerController extends BaseFrontController $nlEvent->setFirstname($updatedCustomer->getFirstname()); $nlEvent->setLastname($updatedCustomer->getLastname()); - if(null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) { + if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) { $nlEvent->setId($newsletter->getId()); $this->dispatch(TheliaEvents::NEWSLETTER_UPDATE, $nlEvent); } else { $this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $nlEvent); } } else { - if(null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) { + if (null !== $newsletter = NewsletterQuery::create()->findOneByEmail($newsletterOldEmail)) { $nlEvent = new NewsletterEvent($updatedCustomer->getEmail(), $this->getRequest()->getSession()->getLang()->getLocale()); $nlEvent->setId($newsletter->getId()); $this->dispatch(TheliaEvents::NEWSLETTER_UNSUBSCRIBE, $nlEvent); diff --git a/core/lib/Thelia/Controller/Front/Mail.php b/core/lib/Thelia/Controller/Front/Mail.php index dfaf2d4fa..f25024f99 100644 --- a/core/lib/Thelia/Controller/Front/Mail.php +++ b/core/lib/Thelia/Controller/Front/Mail.php @@ -23,7 +23,6 @@ namespace Thelia\Controller\Front; - /** * Class Mail * @package Thelia\Controller\Front @@ -46,4 +45,4 @@ class Mail extends BaseFrontController exit; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Controller/Front/NewsletterController.php b/core/lib/Thelia/Controller/Front/NewsletterController.php index 0df57cd61..72c3b0878 100644 --- a/core/lib/Thelia/Controller/Front/NewsletterController.php +++ b/core/lib/Thelia/Controller/Front/NewsletterController.php @@ -27,7 +27,6 @@ use Thelia\Core\Event\Newsletter\NewsletterEvent; use Thelia\Core\Event\TheliaEvents; use Thelia\Form\NewsletterForm; - /** * Class NewsletterController * @package Thelia\Controller\Front @@ -50,15 +49,14 @@ class NewsletterController extends BaseFrontController $this->getRequest()->getSession()->getLang()->getLocale() ); - if (null !== $customer = $this->getSecurityContext()->getCustomerUser()) - { + if (null !== $customer = $this->getSecurityContext()->getCustomerUser()) { $event->setFirstname($customer->getFirstname()); $event->setLastname($customer->getLastname()); } $this->dispatch(TheliaEvents::NEWSLETTER_SUBSCRIBE, $event); - } catch(\Exception $e) { + } catch (\Exception $e) { $error_message = $e->getMessage(); } @@ -90,4 +88,4 @@ class NewsletterController extends BaseFrontController } } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php b/core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php index 43279b093..3e7c667dd 100644 --- a/core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php +++ b/core/lib/Thelia/Core/Event/Lang/LangCreateEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Lang; - /** * Class LangCreateEvent * @package Thelia\Core\Event\Lang @@ -137,5 +136,4 @@ class LangCreateEvent extends LangEvent return $this->title; } - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Lang/LangDefaultBehaviorEvent.php b/core/lib/Thelia/Core/Event/Lang/LangDefaultBehaviorEvent.php index 4c3e857e3..fff119e96 100644 --- a/core/lib/Thelia/Core/Event/Lang/LangDefaultBehaviorEvent.php +++ b/core/lib/Thelia/Core/Event/Lang/LangDefaultBehaviorEvent.php @@ -24,7 +24,6 @@ namespace Thelia\Core\Event\Lang; use Thelia\Core\Event\ActionEvent; - /** * Class LangDefaultBehaviorEvent * @package Thelia\Core\Event\Lang @@ -37,7 +36,7 @@ class LangDefaultBehaviorEvent extends ActionEvent */ protected $defaultBehavior; - function __construct($defaultBehavior) + public function __construct($defaultBehavior) { $this->defaultBehavior = $defaultBehavior; } @@ -58,7 +57,4 @@ class LangDefaultBehaviorEvent extends ActionEvent return $this->defaultBehavior; } - - - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Lang/LangDeleteEvent.php b/core/lib/Thelia/Core/Event/Lang/LangDeleteEvent.php index eebbe27e4..25190f857 100644 --- a/core/lib/Thelia/Core/Event/Lang/LangDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Lang/LangDeleteEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Lang; - /** * Class LangDeleteEvent * @package Thelia\Core\Event\Lang @@ -39,7 +38,7 @@ class LangDeleteEvent extends LangEvent /** * @param int $lang_id */ - function __construct($lang_id) + public function __construct($lang_id) { $this->lang_id = $lang_id; } @@ -64,4 +63,4 @@ class LangDeleteEvent extends LangEvent return $this->lang_id; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Lang/LangEvent.php b/core/lib/Thelia/Core/Event/Lang/LangEvent.php index f66b6428a..1cc7da5e6 100644 --- a/core/lib/Thelia/Core/Event/Lang/LangEvent.php +++ b/core/lib/Thelia/Core/Event/Lang/LangEvent.php @@ -25,7 +25,6 @@ namespace Thelia\Core\Event\Lang; use Thelia\Core\Event\ActionEvent; use Thelia\Model\Lang; - /** * Class LangEvent * @package Thelia\Core\Event\Lang @@ -38,7 +37,7 @@ class LangEvent extends ActionEvent */ protected $lang; - function __construct(Lang $lang = null) + public function __construct(Lang $lang = null) { $this->lang = $lang; } @@ -70,7 +69,4 @@ class LangEvent extends ActionEvent return null !== $this->lang; } - - - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Lang/LangToggleDefaultEvent.php b/core/lib/Thelia/Core/Event/Lang/LangToggleDefaultEvent.php index f31972f01..626396191 100644 --- a/core/lib/Thelia/Core/Event/Lang/LangToggleDefaultEvent.php +++ b/core/lib/Thelia/Core/Event/Lang/LangToggleDefaultEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Lang; - /** * Class LangToggleDefaultEvent * @package Thelia\Core\Event\Lang @@ -39,7 +38,7 @@ class LangToggleDefaultEvent extends LangEvent /** * @param int $lang_id */ - function __construct($lang_id) + public function __construct($lang_id) { $this->lang_id = $lang_id; } @@ -64,6 +63,4 @@ class LangToggleDefaultEvent extends LangEvent return $this->lang_id; } - - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php b/core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php index f0d4b928d..cb6282395 100644 --- a/core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/Lang/LangUpdateEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Lang; - /** * Class LangUpdateEvent * @package Thelia\Core\Event\Lang @@ -39,12 +38,11 @@ class LangUpdateEvent extends LangCreateEvent /** * @param int $id */ - function __construct($id) + public function __construct($id) { $this->id = $id; } - /** * @param int $id * @@ -65,5 +63,4 @@ class LangUpdateEvent extends LangCreateEvent return $this->id; } - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Module/ModuleDeleteEvent.php b/core/lib/Thelia/Core/Event/Module/ModuleDeleteEvent.php index 5622e3931..a2950dffb 100644 --- a/core/lib/Thelia/Core/Event/Module/ModuleDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/Module/ModuleDeleteEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\Module; - /** * Class ModuleDeleteEvent * @package Thelia\Core\Event\Module @@ -36,7 +35,7 @@ class ModuleDeleteEvent extends ModuleEvent */ protected $module_id; - function __construct($module_id) + public function __construct($module_id) { $this->module_id = $module_id; } @@ -57,5 +56,4 @@ class ModuleDeleteEvent extends ModuleEvent return $this->module_id; } - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/Newsletter/NewsletterEvent.php b/core/lib/Thelia/Core/Event/Newsletter/NewsletterEvent.php index 85948a621..1dbd74c4b 100644 --- a/core/lib/Thelia/Core/Event/Newsletter/NewsletterEvent.php +++ b/core/lib/Thelia/Core/Event/Newsletter/NewsletterEvent.php @@ -24,7 +24,6 @@ namespace Thelia\Core\Event\Newsletter; use Thelia\Core\Event\ActionEvent; - /** * Class NewsletterEvent * @package Thelia\Core\Event\Newsletter @@ -57,7 +56,7 @@ class NewsletterEvent extends ActionEvent */ protected $locale; - function __construct($email, $locale) + public function __construct($email, $locale) { $this->email = $email; $this->locale = $locale; @@ -159,8 +158,4 @@ class NewsletterEvent extends ActionEvent return $this->id; } - - - - -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementCreateEvent.php b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementCreateEvent.php index 721342bd8..bbb5d07e7 100644 --- a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementCreateEvent.php +++ b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementCreateEvent.php @@ -24,7 +24,6 @@ namespace Thelia\Core\Event\ProductSaleElement; use Thelia\Model\Product; -use Thelia\Core\Event\Product\ProductEvent; class ProductSaleElementCreateEvent extends ProductSaleElementEvent { @@ -65,15 +64,16 @@ class ProductSaleElementCreateEvent extends ProductSaleElementEvent return $this; } - public function getProduct() { + public function getProduct() + { return $this->product; } - public function setProduct($product) { + public function setProduct($product) + { $this->product = $product; return $this; } - } diff --git a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementDeleteEvent.php b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementDeleteEvent.php index 291d59ac9..811b02fca 100644 --- a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementDeleteEvent.php +++ b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementDeleteEvent.php @@ -23,7 +23,6 @@ namespace Thelia\Core\Event\ProductSaleElement; use Thelia\Model\Product; -use Thelia\Core\Event\Product\ProductEvent; class ProductSaleElementDeleteEvent extends ProductSaleElementEvent { @@ -58,6 +57,7 @@ class ProductSaleElementDeleteEvent extends ProductSaleElementEvent public function setCurrencyId($currency_id) { $this->currency_id = $currency_id; + return $this; } diff --git a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementUpdateEvent.php b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementUpdateEvent.php index 8a0618dc5..5be7156dc 100644 --- a/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementUpdateEvent.php +++ b/core/lib/Thelia/Core/Event/ProductSaleElement/ProductSaleElementUpdateEvent.php @@ -22,9 +22,7 @@ /*************************************************************************************/ namespace Thelia\Core\Event\ProductSaleElement; -use Thelia\Core\Event\Product\ProductCreateEvent; use Thelia\Model\Product; -use Thelia\Core\Event\Product\ProductEvent; class ProductSaleElementUpdateEvent extends ProductSaleElementEvent { @@ -217,6 +215,7 @@ class ProductSaleElementUpdateEvent extends ProductSaleElementEvent public function setFromDefaultCurrency($from_default_currency) { $this->from_default_currency = $from_default_currency; + return $this; } diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index e6e675c83..5bb6028a9 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -552,7 +552,6 @@ final class TheliaEvents const TAX_UPDATE = "action.updateTax"; const TAX_DELETE = "action.deleteTax"; - // -- Profile management --------------------------------------------- const PROFILE_CREATE = "action.createProfile"; diff --git a/core/lib/Thelia/Core/Form/Type/TheliaType.php b/core/lib/Thelia/Core/Form/Type/TheliaType.php index 550760098..eaad895be 100644 --- a/core/lib/Thelia/Core/Form/Type/TheliaType.php +++ b/core/lib/Thelia/Core/Form/Type/TheliaType.php @@ -46,4 +46,4 @@ class TheliaType extends AbstractType { return 'thelia_type'; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Core/Security/AccessManager.php b/core/lib/Thelia/Core/Security/AccessManager.php index 8db6c206f..07fc5bcae 100644 --- a/core/lib/Thelia/Core/Security/AccessManager.php +++ b/core/lib/Thelia/Core/Security/AccessManager.php @@ -23,13 +23,6 @@ namespace Thelia\Core\Security; -use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Security\Resource\AdminResources; -use Thelia\Core\Security\User\UserInterface; -use Thelia\Core\HttpFoundation\Request; -use Thelia\Model\ProfileQuery; -use Thelia\Model\ProfileResourceQuery; - /** * A simple security manager, in charge of checking user * @@ -49,7 +42,7 @@ class AccessManager self::DELETE => false, ); - static protected $accessPows = array( + protected static $accessPows = array( self::VIEW => 3, self::CREATE => 2, self::UPDATE => 1, @@ -67,7 +60,7 @@ class AccessManager public function can($type) { - if(!array_key_exists($type, $this->accessGranted)) { + if (!array_key_exists($type, $this->accessGranted)) { return false; } @@ -75,7 +68,7 @@ class AccessManager } - static public function getMaxAccessValue() + public static function getMaxAccessValue() { return pow(2, current(array_slice( self::$accessPows, -1, 1, true ))) - 1; } @@ -83,8 +76,8 @@ class AccessManager public function build($accesses) { $this->accessValue = 0; - foreach($accesses as $access) { - if(array_key_exists($access, self::$accessPows)) { + foreach ($accesses as $access) { + if (array_key_exists($access, self::$accessPows)) { $this->accessValue += pow(2, self::$accessPows[$access]); } } @@ -95,9 +88,9 @@ class AccessManager protected function fillGrantedAccess() { $accessValue = $this->accessValue; - foreach(self::$accessPows as $type => $value) { + foreach (self::$accessPows as $type => $value) { $pow = pow(2, $value); - if($accessValue >= $pow) { + if ($accessValue >= $pow) { $accessValue -= $pow; $this->accessGranted[$type] = true; } else { @@ -106,7 +99,6 @@ class AccessManager } } - public function getAccessValue() { return $this->accessValue; diff --git a/core/lib/Thelia/Core/Security/Exception/RessourceException.php b/core/lib/Thelia/Core/Security/Exception/RessourceException.php index 27343bd16..c19bcf451 100644 --- a/core/lib/Thelia/Core/Security/Exception/RessourceException.php +++ b/core/lib/Thelia/Core/Security/Exception/RessourceException.php @@ -23,7 +23,7 @@ namespace Thelia\Core\Security\Exception; -class ResourceException extends \RuntimeException +class RessourceException extends \RuntimeException { const UNKNOWN_EXCEPTION = 0; diff --git a/core/lib/Thelia/Core/Security/Resource/AdminResources.php b/core/lib/Thelia/Core/Security/Resource/AdminResources.php index d935c64ab..6efcf89c2 100644 --- a/core/lib/Thelia/Core/Security/Resource/AdminResources.php +++ b/core/lib/Thelia/Core/Security/Resource/AdminResources.php @@ -33,17 +33,17 @@ use Thelia\Core\Security\Exception\ResourceException; */ final class AdminResources { - static private $selfReflection = null; + private static $selfReflection = null; - static public function retrieve($name) + public static function retrieve($name) { $constantName = strtoupper($name); - if(null === self::$selfReflection) { + if (null === self::$selfReflection) { self::$selfReflection = new \ReflectionClass(__CLASS__); } - if(self::$selfReflection->hasConstant($constantName)) { + if (self::$selfReflection->hasConstant($constantName)) { return self::$selfReflection->getConstant($constantName); } else { throw new ResourceException(sprintf('Resource `%s` not found', $constantName), ResourceException::RESOURCE_NOT_FOUND); diff --git a/core/lib/Thelia/Core/Security/SecurityContext.php b/core/lib/Thelia/Core/Security/SecurityContext.php index 087df8810..128feb516 100755 --- a/core/lib/Thelia/Core/Security/SecurityContext.php +++ b/core/lib/Thelia/Core/Security/SecurityContext.php @@ -23,12 +23,9 @@ namespace Thelia\Core\Security; -use Propel\Runtime\ActiveQuery\Criteria; use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Security\User\UserInterface; use Thelia\Core\HttpFoundation\Request; -use Thelia\Model\ProfileQuery; -use Thelia\Model\ProfileResourceQuery; /** * A simple security manager, in charge of checking user @@ -147,29 +144,29 @@ class SecurityContext return true; } - if( !method_exists($user, 'getPermissions') ) { + if ( !method_exists($user, 'getPermissions') ) { return false; } $userPermissions = $user->getPermissions(); - if($userPermissions === AdminResources::SUPERADMINISTRATOR) { + if ($userPermissions === AdminResources::SUPERADMINISTRATOR) { return true; } - foreach($resources as $resource) { - if($resource === '') { + foreach ($resources as $resource) { + if ($resource === '') { continue; } $resource = strtolower($resource); - if(!array_key_exists($resource, $userPermissions)) { + if (!array_key_exists($resource, $userPermissions)) { return false; } - foreach($accesses as $access) { - if(!$userPermissions[$resource]->can($access)) { + foreach ($accesses as $access) { + if (!$userPermissions[$resource]->can($access)) { return false; } } diff --git a/core/lib/Thelia/Core/Template/Element/BaseLoop.php b/core/lib/Thelia/Core/Template/Element/BaseLoop.php index 1ed7292cf..6b6f44146 100755 --- a/core/lib/Thelia/Core/Template/Element/BaseLoop.php +++ b/core/lib/Thelia/Core/Template/Element/BaseLoop.php @@ -27,7 +27,6 @@ use Propel\Runtime\ActiveQuery\Criteria; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Thelia\Core\Template\Element\Exception\SearchLoopException; use Thelia\Core\Template\Loop\Argument\Argument; use Propel\Runtime\ActiveQuery\ModelCriteria; use Thelia\Core\Security\SecurityContext; @@ -95,7 +94,7 @@ abstract class BaseLoop Argument::createBooleanTypeArgument('force_return', false), ); - if(true === $this->countable) { + if (true === $this->countable) { $defaultArgs = array_merge($defaultArgs, array( Argument::createIntTypeArgument('offset', 0), Argument::createIntTypeArgument('page'), @@ -103,7 +102,7 @@ abstract class BaseLoop )); } - if($this instanceof SearchLoopInterface) { + if ($this instanceof SearchLoopInterface) { $defaultArgs = array_merge($defaultArgs, array( Argument::createAnyTypeArgument('search_term'), new Argument( @@ -241,13 +240,13 @@ abstract class BaseLoop */ protected function search(ModelCriteria $search, &$pagination = null) { - if($this instanceof SearchLoopInterface) { + if ($this instanceof SearchLoopInterface) { $searchTerm = $this->getSearch_term(); $searchIn = $this->getSearch_in(); $searchMode = $this->getSearch_mode(); - if(null !== $searchTerm && null !== $searchIn) { + if (null !== $searchTerm && null !== $searchIn) { - switch($searchMode) { + switch ($searchMode) { case SearchLoopInterface::MODE_ANY_WORD: $searchCriteria = Criteria::IN; $searchTerm = explode(' ', $searchTerm); diff --git a/core/lib/Thelia/Core/Template/Element/SearchLoopInterface.php b/core/lib/Thelia/Core/Template/Element/SearchLoopInterface.php index 48876012f..26a154e15 100644 --- a/core/lib/Thelia/Core/Template/Element/SearchLoopInterface.php +++ b/core/lib/Thelia/Core/Template/Element/SearchLoopInterface.php @@ -22,8 +22,6 @@ /*************************************************************************************/ namespace Thelia\Core\Template\Element; -use Symfony\Component\Validator\ExecutionContextInterface; - /** * * @author Etienne Roudeix diff --git a/core/lib/Thelia/Core/Template/Loop/Admin.php b/core/lib/Thelia/Core/Template/Loop/Admin.php index 378bcaf31..581f6faed 100755 --- a/core/lib/Thelia/Core/Template/Loop/Admin.php +++ b/core/lib/Thelia/Core/Template/Loop/Admin.php @@ -24,7 +24,6 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; -use Thelia\Core\Template\Element\BaseI18nLoop; use Thelia\Core\Template\Element\BaseLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -34,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\AdminQuery; use Thelia\Type; -use Thelia\Type\BooleanOrBothType; /** * diff --git a/core/lib/Thelia/Core/Template/Loop/Cart.php b/core/lib/Thelia/Core/Template/Loop/Cart.php index be39371ad..e54675a29 100755 --- a/core/lib/Thelia/Core/Template/Loop/Cart.php +++ b/core/lib/Thelia/Core/Template/Loop/Cart.php @@ -16,7 +16,6 @@ use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Model\CountryQuery; use Thelia\Type; -use Thelia\Type\TypeCollection; class Cart extends BaseLoop { @@ -90,17 +89,17 @@ class Cart extends BaseLoop $countCartItems = count($cartItems); - if($limit <= 0 || $limit >= $countCartItems){ + if ($limit <= 0 || $limit >= $countCartItems) { $limit = $countCartItems; } $position = $this->getPosition(); - if(isset($position)){ - if($position == "first"){ + if (isset($position)) { + if ($position == "first") { $limit = 1; $cartItems = array($cartItems[0]); - }else if($position == "last"){ + } elseif ($position == "last") { $limit = 1; $cartItems = array(end($cartItems)); } diff --git a/core/lib/Thelia/Core/Template/Loop/Content.php b/core/lib/Thelia/Core/Template/Loop/Content.php index 696d8c6cd..8c3258102 100755 --- a/core/lib/Thelia/Core/Template/Loop/Content.php +++ b/core/lib/Thelia/Core/Template/Loop/Content.php @@ -33,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\FolderQuery; use Thelia\Model\Map\ContentTableMap; -use Thelia\Model\ContentFolderQuery; use Thelia\Model\ContentQuery; use Thelia\Type\TypeCollection; use Thelia\Type; diff --git a/core/lib/Thelia/Core/Template/Loop/Customer.php b/core/lib/Thelia/Core/Template/Loop/Customer.php index e49d9ef76..6c0a022a8 100755 --- a/core/lib/Thelia/Core/Template/Loop/Customer.php +++ b/core/lib/Thelia/Core/Template/Loop/Customer.php @@ -88,11 +88,11 @@ class Customer extends BaseLoop implements SearchLoopInterface { $search->_and(); - foreach($searchIn as $index => $searchInElement) { - if($index > 0) { + foreach ($searchIn as $index => $searchInElement) { + if ($index > 0) { $search->_or(); } - switch($searchInElement) { + switch ($searchInElement) { case "ref": $search->filterByRef($searchTerm, $searchCriteria); break; diff --git a/core/lib/Thelia/Core/Template/Loop/Module.php b/core/lib/Thelia/Core/Template/Loop/Module.php index 3c046f61d..1c07d7d5f 100755 --- a/core/lib/Thelia/Core/Template/Loop/Module.php +++ b/core/lib/Thelia/Core/Template/Loop/Module.php @@ -107,7 +107,7 @@ class Module extends BaseI18nLoop $code = $this->getCode(); - if(null !== $code) { + if (null !== $code) { $search->filterByCode($code, Criteria::IN); } diff --git a/core/lib/Thelia/Core/Template/Loop/Order.php b/core/lib/Thelia/Core/Template/Loop/Order.php index 140a64fc3..e10b8a5cb 100755 --- a/core/lib/Thelia/Core/Template/Loop/Order.php +++ b/core/lib/Thelia/Core/Template/Loop/Order.php @@ -32,7 +32,6 @@ use Thelia\Core\Template\Element\SearchLoopInterface; use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\CustomerQuery; -use Thelia\Model\OrderAddress; use Thelia\Model\OrderAddressQuery; use Thelia\Model\OrderQuery; use Thelia\Type\TypeCollection; @@ -100,11 +99,11 @@ class Order extends BaseLoop implements SearchLoopInterface { $search->_and(); - foreach($searchIn as $index => $searchInElement) { - if($index > 0) { + foreach ($searchIn as $index => $searchInElement) { + if ($index > 0) { $search->_or(); } - switch($searchInElement) { + switch ($searchInElement) { case "ref": $search->filterByRef($searchTerm, $searchCriteria); break; diff --git a/core/lib/Thelia/Core/Template/Loop/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php index b110e00c3..701e95935 100755 --- a/core/lib/Thelia/Core/Template/Loop/Product.php +++ b/core/lib/Thelia/Core/Template/Loop/Product.php @@ -26,7 +26,6 @@ namespace Thelia\Core\Template\Loop; use Propel\Runtime\ActiveQuery\Criteria; use Propel\Runtime\ActiveQuery\Join; use Thelia\Core\Template\Element\BaseI18nLoop; -use Thelia\Core\Template\Element\BaseLoop; use Thelia\Core\Template\Element\LoopResult; use Thelia\Core\Template\Element\LoopResultRow; @@ -35,7 +34,6 @@ use Thelia\Core\Template\Loop\Argument\ArgumentCollection; use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Exception\TaxEngineException; -use Thelia\Model\Base\ProductSaleElementsQuery; use Thelia\Model\CategoryQuery; use Thelia\Model\CountryQuery; use Thelia\Model\CurrencyQuery; @@ -148,11 +146,11 @@ class Product extends BaseI18nLoop implements SearchLoopInterface { $search->_and(); - foreach($searchIn as $index => $searchInElement) { - if($index > 0) { + foreach ($searchIn as $index => $searchInElement) { + if ($index > 0) { $search->_or(); } - switch($searchInElement) { + switch ($searchInElement) { case "ref": $search->filterByRef($searchTerm, $searchCriteria); break; @@ -172,7 +170,7 @@ class Product extends BaseI18nLoop implements SearchLoopInterface public function exec(&$pagination) { $complex = $this->getComplex(); - if(true === $complex) { + if (true === $complex) { return $this->execComplex($pagination); } @@ -237,7 +235,7 @@ class Product extends BaseI18nLoop implements SearchLoopInterface $title = $this->getTitle(); - if(!is_null($title)) { + if (!is_null($title)) { $search->where("CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR); } @@ -594,7 +592,7 @@ class Product extends BaseI18nLoop implements SearchLoopInterface $title = $this->getTitle(); - if(!is_null($title)){ + if (!is_null($title)) { $search->where(" CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR); } diff --git a/core/lib/Thelia/Core/Template/Loop/Profile.php b/core/lib/Thelia/Core/Template/Loop/Profile.php index 4ac43d25a..bb2e4a7b5 100755 --- a/core/lib/Thelia/Core/Template/Loop/Profile.php +++ b/core/lib/Thelia/Core/Template/Loop/Profile.php @@ -33,7 +33,6 @@ use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\ProfileQuery; use Thelia\Type; -use Thelia\Type\BooleanOrBothType; /** * diff --git a/core/lib/Thelia/Core/Template/Loop/Resource.php b/core/lib/Thelia/Core/Template/Loop/Resource.php index 2b2d90f70..41400dc65 100755 --- a/core/lib/Thelia/Core/Template/Loop/Resource.php +++ b/core/lib/Thelia/Core/Template/Loop/Resource.php @@ -34,7 +34,6 @@ use Thelia\Core\Template\Loop\Argument\Argument; use Thelia\Model\ResourceQuery; use Thelia\Type; -use Thelia\Type\BooleanOrBothType; /** * @@ -87,7 +86,7 @@ class Resource extends BaseI18nLoop $code = $this->getCode(); - if(null !== $code) { + if (null !== $code) { $search->filterByCode($code, Criteria::IN); } diff --git a/core/lib/Thelia/Core/Template/Loop/TaxRuleCountry.php b/core/lib/Thelia/Core/Template/Loop/TaxRuleCountry.php index ee20a3d20..83539fef6 100644 --- a/core/lib/Thelia/Core/Template/Loop/TaxRuleCountry.php +++ b/core/lib/Thelia/Core/Template/Loop/TaxRuleCountry.php @@ -85,10 +85,10 @@ class TaxRuleCountry extends BaseI18nLoop $country = $this->getCountry(); $taxRule = $this->getTax_rule(); - if($ask === 'countries') { + if ($ask === 'countries') { $taxCountForOriginCountry = TaxRuleCountryQuery::create()->filterByCountryId($country)->count(); - if($taxCountForOriginCountry > 0) { + if ($taxCountForOriginCountry > 0) { $search->groupByCountryId(); $originalCountryJoin = new Join(); @@ -127,7 +127,7 @@ class TaxRuleCountry extends BaseI18nLoop $search->addAscendingOrderByColumn('i18n_TITLE'); } - } elseif($ask === 'taxes') { + } elseif ($ask === 'taxes') { $search->filterByCountryId($country); /* manage tax translation */ @@ -151,8 +151,8 @@ class TaxRuleCountry extends BaseI18nLoop $loopResultRow = new LoopResultRow($loopResult, $taxRuleCountry, $this->versionable, $this->timestampable, $this->countable); - if($ask === 'countries') { - if($taxCountForOriginCountry > 0) { + if ($ask === 'countries') { + if ($taxCountForOriginCountry > 0) { $loopResultRow ->set("COUNTRY" , $taxRuleCountry->getCountryId()) ->set("COUNTRY_TITLE" , $taxRuleCountry->getVirtualColumn(CountryTableMap::TABLE_NAME . '_i18n_TITLE')) @@ -167,7 +167,7 @@ class TaxRuleCountry extends BaseI18nLoop ->set("COUNTRY_DESCRIPTION" , $taxRuleCountry->getVirtualColumn('i18n_DESCRIPTION')) ->set("COUNTRY_POSTSCRIPTUM" , $taxRuleCountry->getVirtualColumn('i18n_POSTSCRIPTUM')); } - } elseif($ask === 'taxes') { + } elseif ($ask === 'taxes') { $loopResultRow ->set("TAX_RULE" , $taxRuleCountry->getTaxRuleId()) ->set("COUNTRY" , $taxRuleCountry->getCountryId()) @@ -178,8 +178,6 @@ class TaxRuleCountry extends BaseI18nLoop ; } - - $loopResult->addRow($loopResultRow); } diff --git a/core/lib/Thelia/Core/Template/ParserContext.php b/core/lib/Thelia/Core/Template/ParserContext.php index fe069901e..1f80f7cd5 100755 --- a/core/lib/Thelia/Core/Template/ParserContext.php +++ b/core/lib/Thelia/Core/Template/ParserContext.php @@ -24,7 +24,6 @@ namespace Thelia\Core\Template; use Thelia\Core\Thelia; -use Thelia\Model\ConfigQuery; use Thelia\Core\HttpFoundation\Request; use Thelia\Form\BaseForm; /** diff --git a/core/lib/Thelia/Core/Template/Smarty/AbstractSmartyPlugin.php b/core/lib/Thelia/Core/Template/Smarty/AbstractSmartyPlugin.php index 8ef21f51e..b596f9d81 100755 --- a/core/lib/Thelia/Core/Template/Smarty/AbstractSmartyPlugin.php +++ b/core/lib/Thelia/Core/Template/Smarty/AbstractSmartyPlugin.php @@ -40,7 +40,7 @@ abstract class AbstractSmartyPlugin */ protected function _explode($commaSeparatedValues) { - if(null === $commaSeparatedValues) { + if (null === $commaSeparatedValues) { return array(); } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php index 97986e146..494e219eb 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php @@ -60,8 +60,8 @@ use Symfony\Component\Form\Extension\Core\View\ChoiceView; */ class Form extends AbstractSmartyPlugin { - static private $taggedFieldsStack = null; - static private $taggedFieldsStackPosition = null; + private static $taggedFieldsStack = null; + private static $taggedFieldsStackPosition = null; protected $request; protected $parserContext; @@ -113,8 +113,7 @@ class Form extends AbstractSmartyPlugin $template->assign("form_error", $instance->hasError() ? true : false); $template->assign("form_error_message", $instance->getErrorMessage()); - } - else { + } else { return $content; } } @@ -127,7 +126,6 @@ class Form extends AbstractSmartyPlugin $template->assign("checked", isset($fieldVars['checked']) ? $fieldVars['checked'] : false); - //data $template->assign("data", $fieldVars['data']); @@ -161,13 +159,13 @@ class Form extends AbstractSmartyPlugin $formFieldType = $formFieldConfig->getType()->getInnerType(); /* access to choices */ - if($formFieldType instanceof ChoiceType) { + if ($formFieldType instanceof ChoiceType) { $template->assign("choices", $formFieldView->vars['choices']); } /* access to collections */ - if($formFieldType instanceof CollectionType) { - if( true === $formFieldConfig->getOption('prototype') ) { + if ($formFieldType instanceof CollectionType) { + if ( true === $formFieldConfig->getOption('prototype') ) { } else { /* access to choices */ @@ -179,17 +177,16 @@ class Form extends AbstractSmartyPlugin } /* access to thelia type */ - if($formFieldType instanceof TheliaType) { + if ($formFieldType instanceof TheliaType) { $template->assign("formType", $formFieldView->vars['type']); - - switch($formFieldView->vars['type']) { + switch ($formFieldView->vars['type']) { case "choice": - if(!isset($formFieldView->vars['options']['choices']) || !is_array($formFieldView->vars['options']['choices'])) { + if (!isset($formFieldView->vars['options']['choices']) || !is_array($formFieldView->vars['options']['choices'])) { //throw new } $choices = array(); - foreach($formFieldView->vars['options']['choices'] as $value => $choice) { + foreach ($formFieldView->vars['options']['choices'] as $value => $choice) { $choices[] = new ChoiceView($value, $value, $choice); } $template->assign("choices", $choices); @@ -223,32 +220,29 @@ class Form extends AbstractSmartyPlugin $val = $value[$key]; $this->assignFieldValues($template, $name, $val, $formFieldView->vars, $value_count); - } - else { + } else { throw new \InvalidArgumentException(sprintf("Missing or empty parameter 'value_key' for field '%s'", $formFieldView->vars["name"])); } - } - else { + } else { $this->assignFieldValues($template, $formFieldView->vars["full_name"], $formFieldView->vars["value"], $formFieldView->vars); } $formFieldView->setRendered(); - } - else { + } else { return $content; } } public function renderTaggedFormFields($params, $content, \Smarty_Internal_Template $template, &$repeat) { - if(null === $content) { + if (null === $content) { self::$taggedFieldsStack = $this->getFormFieldsFromTag($params); self::$taggedFieldsStackPosition = 0; } else { self::$taggedFieldsStackPosition++; } - if(isset(self::$taggedFieldsStack[self::$taggedFieldsStackPosition])) { + if (isset(self::$taggedFieldsStack[self::$taggedFieldsStackPosition])) { $this->assignFieldValues( $template, self::$taggedFieldsStack[self::$taggedFieldsStackPosition]['view']->vars["full_name"], @@ -268,7 +262,7 @@ class Form extends AbstractSmartyPlugin self::$taggedFieldsStackPosition = null; } - if(null !== $content) { + if (null !== $content) { return $content; } } @@ -322,8 +316,7 @@ class Form extends AbstractSmartyPlugin if ($repeat) { $this->assignFieldErrorVars($template, $errors); - } - else { + } else { return $content; } } @@ -364,8 +357,8 @@ class Form extends AbstractSmartyPlugin throw new \InvalidArgumentException("'tag' parameter is missing"); $viewList = array(); - foreach($instance->getView() as $view) { - if(isset($view->vars['attr']['tag']) && $tag == $view->vars['attr']['tag']) { + foreach ($instance->getView() as $view) { + if (isset($view->vars['attr']['tag']) && $tag == $view->vars['attr']['tag']) { $fieldData = $instance->getForm()->all()[$view->vars['name']]; $viewList[] = array( 'view' => $view, diff --git a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php index e9b0fef8a..68da0af12 100755 --- a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php +++ b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php @@ -8,7 +8,6 @@ use \Symfony\Component\EventDispatcher\EventDispatcherInterface; use \Smarty; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\HttpException; use Thelia\Core\Template\ParserInterface; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; diff --git a/core/lib/Thelia/Form/AdministratorCreationForm.php b/core/lib/Thelia/Form/AdministratorCreationForm.php index afab36cac..4b5afe34c 100644 --- a/core/lib/Thelia/Form/AdministratorCreationForm.php +++ b/core/lib/Thelia/Form/AdministratorCreationForm.php @@ -25,12 +25,9 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\ExecutionContextInterface; -use Thelia\Core\Security\AccessManager; -use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Translation\Translator; use Thelia\Model\AdminQuery; use Thelia\Model\ProfileQuery; -use Thelia\Model\ConfigQuery; class AdministratorCreationForm extends BaseForm { @@ -110,7 +107,7 @@ class AdministratorCreationForm extends BaseForm { $data = $context->getRoot()->getData(); - if($data["password"] === '' && $data["password_confirm"] === '') { + if ($data["password"] === '' && $data["password_confirm"] === '') { $context->addViolation("password can't be empty"); } @@ -118,7 +115,7 @@ class AdministratorCreationForm extends BaseForm $context->addViolation("password confirmation is not the same as password field"); } - if(strlen($data["password"]) < 4) { + if (strlen($data["password"]) < 4) { $context->addViolation("password must be composed of at least 4 characters"); } } @@ -135,4 +132,4 @@ class AdministratorCreationForm extends BaseForm { return "thelia_admin_administrator_creation"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/AdministratorModificationForm.php b/core/lib/Thelia/Form/AdministratorModificationForm.php index 68ad228a5..7e7a4a845 100755 --- a/core/lib/Thelia/Form/AdministratorModificationForm.php +++ b/core/lib/Thelia/Form/AdministratorModificationForm.php @@ -25,7 +25,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; -use Thelia\Core\Translation\Translator; use Thelia\Model\AdminQuery; class AdministratorModificationForm extends AdministratorCreationForm @@ -90,7 +89,7 @@ class AdministratorModificationForm extends AdministratorCreationForm $context->addViolation("password confirmation is not the same as password field"); } - if($data["password"] !== '' && strlen($data["password"]) < 4) { + if ($data["password"] !== '' && strlen($data["password"]) < 4) { $context->addViolation("password must be composed of at least 4 characters"); } } diff --git a/core/lib/Thelia/Form/ContactForm.php b/core/lib/Thelia/Form/ContactForm.php index 3cc7bc737..8497a2222 100644 --- a/core/lib/Thelia/Form/ContactForm.php +++ b/core/lib/Thelia/Form/ContactForm.php @@ -27,7 +27,6 @@ use Symfony\Component\Validator\Constraints\Email; use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Core\Translation\Translator; - /** * Class ContactForm * @package Thelia\Form @@ -107,4 +106,4 @@ class ContactForm extends BaseForm { return 'thelia_contact'; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/CouponCode.php b/core/lib/Thelia/Form/CouponCode.php index 06dceb177..d9b546f1f 100755 --- a/core/lib/Thelia/Form/CouponCode.php +++ b/core/lib/Thelia/Form/CouponCode.php @@ -23,8 +23,6 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; -use Thelia\Model\ModuleQuery; -use Thelia\Module\BaseModule; /** * Class CouponCode diff --git a/core/lib/Thelia/Form/CouponCreationForm.php b/core/lib/Thelia/Form/CouponCreationForm.php index 448f65e38..9a38b0d83 100755 --- a/core/lib/Thelia/Form/CouponCreationForm.php +++ b/core/lib/Thelia/Form/CouponCreationForm.php @@ -27,7 +27,6 @@ use Symfony\Component\Validator\Constraints\Date; use Symfony\Component\Validator\Constraints\GreaterThanOrEqual; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\NotEqualTo; -use Symfony\Component\Validator\Constraints\Range; /** * Created by JetBrains PhpStorm. diff --git a/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php b/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php index 3b4cfec40..afea21f70 100755 --- a/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php +++ b/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php @@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Model\ConfigQuery; use Thelia\Core\Translation\Translator; -use Thelia\Model\CustomerQuery; /** * Class CustomerPasswordUpdateForm diff --git a/core/lib/Thelia/Form/CustomerProfilUpdateForm.php b/core/lib/Thelia/Form/CustomerProfilUpdateForm.php index 210d6edbc..d1e928d0c 100755 --- a/core/lib/Thelia/Form/CustomerProfilUpdateForm.php +++ b/core/lib/Thelia/Form/CustomerProfilUpdateForm.php @@ -22,11 +22,8 @@ /*************************************************************************************/ namespace Thelia\Form; -use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Model\CustomerQuery; -use Thelia\Model\ConfigQuery; -use Thelia\Core\Translation\Translator; /** * Class CustomerProfilUpdateForm @@ -69,7 +66,6 @@ class CustomerProfilUpdateForm extends CustomerCreateForm )); } - /** * @param $value * @param ExecutionContextInterface $context diff --git a/core/lib/Thelia/Form/Lang/LangCreateForm.php b/core/lib/Thelia/Form/Lang/LangCreateForm.php index deef71802..ccad58320 100644 --- a/core/lib/Thelia/Form/Lang/LangCreateForm.php +++ b/core/lib/Thelia/Form/Lang/LangCreateForm.php @@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Form\BaseForm; use Thelia\Core\Translation\Translator; - /** * Class LangCreateForm * @package Thelia\Form\Lang @@ -113,4 +112,4 @@ class LangCreateForm extends BaseForm { return 'thelia_language_create'; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/Lang/LangDefaultBehaviorForm.php b/core/lib/Thelia/Form/Lang/LangDefaultBehaviorForm.php index 23418a392..38a48a007 100644 --- a/core/lib/Thelia/Form/Lang/LangDefaultBehaviorForm.php +++ b/core/lib/Thelia/Form/Lang/LangDefaultBehaviorForm.php @@ -24,11 +24,9 @@ namespace Thelia\Form\Lang; use Symfony\Component\Validator\Constraints\NotBlank; -use Symfony\Component\Validator\Constraints\Range; use Thelia\Form\BaseForm; use Thelia\Core\Translation\Translator; - /** * Class LangDefaultBehaviorForm * @package Thelia\Form\Lang @@ -82,4 +80,4 @@ class LangDefaultBehaviorForm extends BaseForm { return 'thelia_lang_defaultBehavior'; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/Lang/LangUpdateForm.php b/core/lib/Thelia/Form/Lang/LangUpdateForm.php index 0463335f7..e0c572797 100644 --- a/core/lib/Thelia/Form/Lang/LangUpdateForm.php +++ b/core/lib/Thelia/Form/Lang/LangUpdateForm.php @@ -25,7 +25,6 @@ namespace Thelia\Form\Lang; use Symfony\Component\Validator\Constraints\GreaterThan; use Symfony\Component\Validator\Constraints\NotBlank; - /** * Class LangUpdateForm * @package Thelia\Form\Lang @@ -51,4 +50,4 @@ class LangUpdateForm extends LangCreateForm { return 'thelia_lang_update'; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/Lang/LangUrlEvent.php b/core/lib/Thelia/Form/Lang/LangUrlEvent.php index de8248c81..18366f094 100644 --- a/core/lib/Thelia/Form/Lang/LangUrlEvent.php +++ b/core/lib/Thelia/Form/Lang/LangUrlEvent.php @@ -24,7 +24,6 @@ namespace Thelia\Form\Lang; use Thelia\Core\Event\ActionEvent; - /** * Class LangUrlEvent * @package Thelia\Form\Lang @@ -43,4 +42,4 @@ class LangUrlEvent extends ActionEvent { return $this->url; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/Lang/LangUrlForm.php b/core/lib/Thelia/Form/Lang/LangUrlForm.php index ec9837329..784924728 100644 --- a/core/lib/Thelia/Form/Lang/LangUrlForm.php +++ b/core/lib/Thelia/Form/Lang/LangUrlForm.php @@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints\NotBlank; use Thelia\Form\BaseForm; use Thelia\Model\LangQuery; - /** * Class LangUrlForm * @package Thelia\Form\Lang @@ -84,4 +83,4 @@ class LangUrlForm extends BaseForm { return 'thelia_language_url'; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/NewsletterForm.php b/core/lib/Thelia/Form/NewsletterForm.php index 3772df71d..ad0aab5a4 100644 --- a/core/lib/Thelia/Form/NewsletterForm.php +++ b/core/lib/Thelia/Form/NewsletterForm.php @@ -30,7 +30,6 @@ use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Core\Translation\Translator; use Thelia\Model\NewsletterQuery; - /** * Class NewsletterForm * @package Thelia\Form @@ -95,4 +94,4 @@ class NewsletterForm extends BaseForm { return 'thelia_newsletter'; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/ProductDefaultSaleElementUpdateForm.php b/core/lib/Thelia/Form/ProductDefaultSaleElementUpdateForm.php index ad0a852c9..2643692a2 100644 --- a/core/lib/Thelia/Form/ProductDefaultSaleElementUpdateForm.php +++ b/core/lib/Thelia/Form/ProductDefaultSaleElementUpdateForm.php @@ -111,4 +111,4 @@ class ProductDefaultSaleElementUpdateForm extends ProductSaleElementUpdateForm { return "thelia_product_default_sale_element_update_form"; } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Form/ProfileUpdateModuleAccessForm.php b/core/lib/Thelia/Form/ProfileUpdateModuleAccessForm.php index fcbee854f..488c22d42 100644 --- a/core/lib/Thelia/Form/ProfileUpdateModuleAccessForm.php +++ b/core/lib/Thelia/Form/ProfileUpdateModuleAccessForm.php @@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Core\Security\AccessManager; -use Thelia\Core\Translation\Translator; use Thelia\Model\ProfileQuery; use Thelia\Model\ModuleQuery; @@ -57,7 +56,7 @@ class ProfileUpdateModuleAccessForm extends BaseForm )) ; - foreach(ModuleQuery::create()->find() as $module) { + foreach (ModuleQuery::create()->find() as $module) { $this->formBuilder->add( self::MODULE_ACCESS_FIELD_PREFIX . ':' . str_replace(".", ":", $module->getCode()), "choice", diff --git a/core/lib/Thelia/Form/ProfileUpdateResourceAccessForm.php b/core/lib/Thelia/Form/ProfileUpdateResourceAccessForm.php index 99ef2ccf3..69a982ac6 100644 --- a/core/lib/Thelia/Form/ProfileUpdateResourceAccessForm.php +++ b/core/lib/Thelia/Form/ProfileUpdateResourceAccessForm.php @@ -26,7 +26,6 @@ use Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\ExecutionContextInterface; use Thelia\Core\Security\AccessManager; -use Thelia\Core\Translation\Translator; use Thelia\Model\ProfileQuery; use Thelia\Model\ResourceQuery; @@ -57,7 +56,7 @@ class ProfileUpdateResourceAccessForm extends BaseForm )) ; - foreach(ResourceQuery::create()->find() as $resource) { + foreach (ResourceQuery::create()->find() as $resource) { $this->formBuilder->add( self::RESOURCE_ACCESS_FIELD_PREFIX . ':' . str_replace(".", ":", $resource->getCode()), "choice", diff --git a/core/lib/Thelia/Form/TaxCreationForm.php b/core/lib/Thelia/Form/TaxCreationForm.php index abc8fa316..65617e615 100644 --- a/core/lib/Thelia/Form/TaxCreationForm.php +++ b/core/lib/Thelia/Form/TaxCreationForm.php @@ -43,7 +43,7 @@ class TaxCreationForm extends BaseForm $types = TaxEngine::getInstance()->getTaxTypeList(); $typeList = array(); $requirementList = array(); - foreach($types as $type) { + foreach ($types as $type) { $classPath = "\\Thelia\\TaxEngine\\TaxType\\$type"; $instance = new $classPath(); $typeList[$type] = $instance->getTitle(); @@ -65,8 +65,8 @@ class TaxCreationForm extends BaseForm )) ; - foreach($requirementList as $type => $requirements) { - foreach($requirements as $name => $requirementType) { + foreach ($requirementList as $type => $requirements) { + foreach ($requirements as $name => $requirementType) { $this->formBuilder ->add($type . ':' . $name, new TheliaType(), array( //"instance" => $requirementType, diff --git a/core/lib/Thelia/Module/BaseModule.php b/core/lib/Thelia/Module/BaseModule.php index 79acdd4b3..15853a398 100755 --- a/core/lib/Thelia/Module/BaseModule.php +++ b/core/lib/Thelia/Module/BaseModule.php @@ -142,13 +142,12 @@ abstract class BaseModule extends ContainerAware } catch (\UnexpectedValueException $e) { throw $e; } - if(null === $con) { + if (null === $con) { $con = \Propel\Runtime\Propel::getConnection( ModuleImageTableMap::DATABASE_NAME ); } - /* browse the directory */ $imagePosition = 1; foreach ($directoryBrowser as $directoryContent) { diff --git a/core/lib/Thelia/Tests/Coupon/CouponBaseAdapterTest.php b/core/lib/Thelia/Tests/Coupon/CouponBaseAdapterTest.php deleted file mode 100644 index 8e2d0addb..000000000 --- a/core/lib/Thelia/Tests/Coupon/CouponBaseAdapterTest.php +++ /dev/null @@ -1,47 +0,0 @@ -. */ -/* */ -/**********************************************************************************/ - -namespace Thelia\Coupon; - -/** - * Created by JetBrains PhpStorm. - * Date: 8/19/13 - * Time: 3:24 PM - * - * Unit Test BaseFacade Class - * - * @package Coupon - * @author Guillaume MOREL - * - */ -class CouponBaseAdapterTest extends \PHPUnit_Framework_TestCase -{ - public function testSomething() - { - // Stop here and mark this test as incomplete. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - -} diff --git a/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php b/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php deleted file mode 100644 index 648dbcd19..000000000 --- a/core/lib/Thelia/Tests/Coupon/CouponFactoryTest.php +++ /dev/null @@ -1,48 +0,0 @@ -. */ -/* */ -/**********************************************************************************/ - -namespace Thelia\Coupon; - -require_once 'CouponManagerTest.php'; - -/** - * Created by JetBrains PhpStorm. - * Date: 8/19/13 - * Time: 3:24 PM - * - * Unit Test CouponFactory Class - * - * @package Coupon - * @author Guillaume MOREL - * - */ -class CouponFactoryTest extends \PHPUnit_Framework_TestCase -{ - public function testSomething() - { - // Stop here and mark this test as incomplete. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php b/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php deleted file mode 100644 index 751a1ba33..000000000 --- a/core/lib/Thelia/Tests/Coupon/CouponManagerTest.php +++ /dev/null @@ -1,48 +0,0 @@ -. */ -/* */ -/**********************************************************************************/ - -namespace Thelia\Coupon; - - -/** - * Created by JetBrains PhpStorm. - * Date: 8/19/13 - * Time: 3:24 PM - * - * Unit Test CouponManager Class - * - * @package Coupon - * @author Guillaume MOREL - * - */ -class CouponManagerTest extends \PHPUnit_Framework_TestCase -{ - public function testSomething() - { - // Stop here and mark this test as incomplete. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } - -} diff --git a/core/lib/Thelia/Tests/Coupon/CouponRuleCollectionTest.php b/core/lib/Thelia/Tests/Coupon/CouponRuleCollectionTest.php deleted file mode 100644 index 0745e9b98..000000000 --- a/core/lib/Thelia/Tests/Coupon/CouponRuleCollectionTest.php +++ /dev/null @@ -1,46 +0,0 @@ -. */ -/* */ -/**********************************************************************************/ - -namespace Thelia\Coupon; - -/** - * Created by JetBrains PhpStorm. - * Date: 8/19/13 - * Time: 3:24 PM - * - * Unit Test ConditionCollection Class - * - * @package Coupon - * @author Guillaume MOREL - * - */ -class CouponRuleCollectionTest extends \PHPUnit_Framework_TestCase -{ - public function testSomething() - { - // Stop here and mark this test as incomplete. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/core/lib/Thelia/Tests/Coupon/RuleOrganizerTest.php b/core/lib/Thelia/Tests/Coupon/RuleOrganizerTest.php deleted file mode 100644 index d13184a8c..000000000 --- a/core/lib/Thelia/Tests/Coupon/RuleOrganizerTest.php +++ /dev/null @@ -1,73 +0,0 @@ -. */ -/* */ -/**********************************************************************************/ - -namespace Thelia\Coupon; - -use Thelia\Coupon\RuleOrganizer; -/** - * Created by JetBrains PhpStorm. - * Date: 8/19/13 - * Time: 3:24 PM - * - * Unit Test RuleOrganizer Class - * - * @package Coupon - * @author Guillaume MOREL - * - */ -class RuleOrganizerTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var RuleOrganizer - */ - protected $object; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() - { - $this->object = new RuleOrganizer(); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - - /** - * @covers Thelia\Coupon\RuleOrganizer::organize - * @todo Implement testOrganize(). - */ - public function testOrganize() - { - // Remove the following lines when you implement this test. - $this->markTestIncomplete( - 'This test has not been implemented yet.' - ); - } -} diff --git a/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php b/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php deleted file mode 100644 index ee8ed3068..000000000 --- a/core/lib/Thelia/Tests/Coupon/Type/RemoveXAmountTest.php +++ /dev/null @@ -1,65 +0,0 @@ -. */ -/* */ -/**********************************************************************************/ - -namespace Thelia\Coupon; - - -//require_once '../CouponManagerTest.php'; - -/** - * Created by JetBrains PhpStorm. - * Date: 8/19/13 - * Time: 3:24 PM - * - * Unit Test RemoveXAmount Class - * - * @package Coupon - * @author Guillaume MOREL - * - */ -class RemoveXAmountTest extends \PHPUnit_Framework_TestCase -{ - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() - { - } - - public function testSomething() - { - // Stop here and mark this test as incomplete. - $this->markTestIncomplete( - 'This coupon has not been implemented yet.' - ); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } -} diff --git a/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php b/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php deleted file mode 100644 index bbb0c24a3..000000000 --- a/core/lib/Thelia/Tests/Coupon/Type/RemoveXPercentTest.php +++ /dev/null @@ -1,67 +0,0 @@ -. */ -/* */ -/**********************************************************************************/ - -namespace Thelia\Coupon; - -use PHPUnit_Framework_TestCase; - -//require_once '../CouponManagerTest.php'; - -/** - * Created by JetBrains PhpStorm. - * Date: 8/19/13 - * Time: 3:24 PM - * - * Unit Test RemoveXPercent Class - * - * @package Coupon - * @author Guillaume MOREL - * - */ -class RemoveXPercentTest extends \PHPUnit_Framework_TestCase -{ - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ - protected function setUp() - { - } - - public function testSomething() - { - $this->markTestIncomplete( - 'This coupon has not been implemented yet.' - ); - } - - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() - { - } - -} diff --git a/core/lib/Thelia/Tests/Tools/FileManagerTest.php b/core/lib/Thelia/Tests/Tools/FileManagerTest.php index 3ad898ef2..ea8588b19 100644 --- a/core/lib/Thelia/Tests/Tools/FileManagerTest.php +++ b/core/lib/Thelia/Tests/Tools/FileManagerTest.php @@ -30,7 +30,7 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase /** * @covers Thelia\Tools\FileManager::copyUploadedFile */ - public function testCopyUploadedFile() +/* public function testCopyUploadedFile() { $this->markTestIncomplete( 'This test has not been implemented yet : Mock issue' @@ -103,13 +103,13 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase $actual = $fileManager->copyUploadedFile(24, FileManager::TYPE_PRODUCT, $stubProductImage, $stubUploadedFile, $newUploadedFiles, FileManager::FILE_TYPE_IMAGES); $this->assertCount(1, $actual); - } + }*/ /** * @covers Thelia\Tools\FileManager::copyUploadedFile * @expectedException \Thelia\Exception\ImageException */ - public function testCopyUploadedFileExceptionImageException() + /*public function testCopyUploadedFileExceptionImageException() { $this->markTestIncomplete( 'This test has not been implemented yet : Mock issue' @@ -181,7 +181,7 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase $actual = $fileManager->copyUploadedFile(24, FileManager::TYPE_PRODUCT, $stubProductImage, $stubUploadedFile, $newUploadedFiles, FileManager::FILE_TYPE_DOCUMENTS); - } + }*/ /** * @covers Thelia\Tools\FileManager::saveImage @@ -650,23 +650,23 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase /** * @covers Thelia\Tools\FileManager::getImageForm */ - public function testGetImageForm() +/* public function testGetImageForm() { // Mock issue $this->markTestIncomplete( 'This test has not been implemented yet.' ); - } + }*/ /** * @covers Thelia\Tools\FileManager::getDocumentForm */ - public function testGetDocumentForm() +/* public function testGetDocumentForm() { // Mock issue $this->markTestIncomplete( 'This test has not been implemented yet.' ); - } + }*/ /** * @covers Thelia\Tools\FileManager::getUploadDir @@ -879,21 +879,21 @@ class FileManagerTest extends \PHPUnit_Framework_TestCase /** * @covers Thelia\Tools\FileManager::adminLogAppend */ - public function testAdminLogAppend() +/* public function testAdminLogAppend() { $this->markTestIncomplete( 'This test has not been implemented yet.' ); - } + }*/ /** * @covers Thelia\Tools\FileManager::deleteFile */ - public function testDeleteFile() + /* public function testDeleteFile() { // @todo see http://tech.vg.no/2011/03/09/mocking-the-file-system-using-phpunit-and-vfsstream/ $this->markTestIncomplete( 'This test has not been implemented yet.' ); - } + }*/ } diff --git a/core/lib/Thelia/Tools/NumberFormat.php b/core/lib/Thelia/Tools/NumberFormat.php index 2c49a2751..ae25404d7 100644 --- a/core/lib/Thelia/Tools/NumberFormat.php +++ b/core/lib/Thelia/Tools/NumberFormat.php @@ -46,7 +46,6 @@ class NumberFormat if ($decimals == null) $decimals = $lang->getDecimals(); if ($decPoint == null) $decPoint = $lang->getDecimalSeparator(); if ($thousandsSep == null) $thousandsSep = $lang->getThousandsSeparator(); - return number_format($number, $decimals, $decPoint, $thousandsSep); } -} \ No newline at end of file +} diff --git a/core/lib/Thelia/Type/BaseType.php b/core/lib/Thelia/Type/BaseType.php index 9beb180e7..79a859632 100644 --- a/core/lib/Thelia/Type/BaseType.php +++ b/core/lib/Thelia/Type/BaseType.php @@ -39,7 +39,7 @@ abstract class BaseType implements TypeInterface public function verifyForm($value, ExecutionContextInterface $context) { - if( ! $this->isValid($value) ) { + if ( ! $this->isValid($value) ) { $context->addViolation(sprintf("received value `%s` does not match `%s` type", $value, $this->getType())); } } diff --git a/core/lib/Thelia/Type/ModelValidIdType.php b/core/lib/Thelia/Type/ModelValidIdType.php index a9bfec7b5..b3579a51a 100755 --- a/core/lib/Thelia/Type/ModelValidIdType.php +++ b/core/lib/Thelia/Type/ModelValidIdType.php @@ -78,7 +78,7 @@ class ModelValidIdType extends BaseType $queryClass = $this->expectedModelActiveRecordQuery; $choices = array(); - foreach($queryClass::create()->find() as $item) { + foreach ($queryClass::create()->find() as $item) { $choices[$item->getId()] = method_exists($item, "getTitle") ? $item->getTitle() : $item->getId(); }