Completed
Push — develop ( 36492c...3d5a51 )
by Aleksey
03:25
created
src/SpeckCatalog/Service/Spec.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -15,11 +15,17 @@
 block discarded – undo
15 15
         return $spec;
16 16
     }
17 17
 
18
+    /**
19
+     * @param integer $productId
20
+     */
18 21
     public function getByProductId($productId)
19 22
     {
20 23
         return $this->getEntityMapper()->getByProductId($productId);
21 24
     }
22 25
 
26
+    /**
27
+     * @param \SpeckCatalog\Model\Spec $spec
28
+     */
23 29
     public function insert($spec)
24 30
     {
25 31
         $id = parent::insert($spec);
Please login to merge, or discard this patch.
src/SpeckCatalog/View/Helper/UomToCart.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -262,6 +262,9 @@
 block discarded – undo
262 262
         return $this;
263 263
     }
264 264
 
265
+    /**
266
+     * @param string $name
267
+     */
265 268
     public function getService($name)
266 269
     {
267 270
         if (!array_key_exists($name, $this->services)) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
         //data needed to represent a uom to be displayed
93 93
         $data = array(
94 94
             'enabled'    => false,
95
-            'key'        => $uom->getUomCode().$uom->getQuantity(),
95
+            'key'        => $uom->getUomCode() . $uom->getQuantity(),
96 96
             'price'      => 'N/A',
97 97
             'name'       => $uom->getUom()->getName(),
98 98
             'code'       => $uom->getUomCode(),
99 99
             'quantity'   => $uom->getQuantity(),
100
-            'uom_string' => $uom->getUomCode().$uom->getQuantity(),
100
+            'uom_string' => $uom->getUomCode() . $uom->getQuantity(),
101 101
         );
102 102
         if ($enabled) {
103 103
             $data['enabled'] = true;
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     public function renderMany($uoms, $uomString = null, $quantity = 1)
171 171
     {
172 172
         foreach ($uoms as $uom) {
173
-            $key= $uom['key'];
173
+            $key = $uom['key'];
174 174
             $options[$key] = array(
175 175
                 'value' => $key,
176 176
                 'label' => $this->getDisplayName($uom, true),
Please login to merge, or discard this patch.
test/SpeckCatalogTest/Mapper/TestAsset/AbstractTestCase.php 1 patch
Doc Comments   +21 added lines patch added patch discarded remove patch
@@ -39,6 +39,9 @@  discard block
 block discarded – undo
39 39
         return (int) $result->getGeneratedValue();
40 40
     }
41 41
 
42
+    /**
43
+     * @param integer $parentOptionId
44
+     */
42 45
     public function insertChoice($parentOptionId)
43 46
     {
44 47
         $mapper = $this->getTestMapper();
@@ -48,6 +51,11 @@  discard block
 block discarded – undo
48 51
         return (int) $result->getGeneratedValue();
49 52
     }
50 53
 
54
+    /**
55
+     * @param integer $productId
56
+     * @param string $uomCode
57
+     * @param integer $quantity
58
+     */
51 59
     public function insertProductUom($productId, $uomCode, $quantity)
52 60
     {
53 61
         $productUom = array(
@@ -61,6 +69,12 @@  discard block
 block discarded – undo
61 69
         $mapper->insert($productUom, 'catalog_product_uom');
62 70
     }
63 71
 
72
+    /**
73
+     * @param integer $productId
74
+     * @param string $uomCode
75
+     * @param integer $quantity
76
+     * @param integer $distributorId
77
+     */
64 78
     public function insertAvailability($productId, $uomCode, $quantity, $distributorId)
65 79
     {
66 80
         $availability = array(
@@ -74,6 +88,9 @@  discard block
 block discarded – undo
74 88
         $mapper->insert($availability, 'catalog_availability');
75 89
     }
76 90
 
91
+    /**
92
+     * @param string $parentType
93
+     */
77 94
     public function insertImage($parentType, $parentId = 1)
78 95
     {
79 96
         $mapper = $this->getTestMapper();
@@ -108,6 +125,10 @@  discard block
 block discarded – undo
108 125
         return (int) $result->getGeneratedValue();
109 126
     }
110 127
 
128
+    /**
129
+     * @param string $uomCode
130
+     * @param string $name
131
+     */
111 132
     public function insertUom($uomCode, $name)
112 133
     {
113 134
         $uom = array('uom_code' => $uomCode, 'name' => $name);
Please login to merge, or discard this patch.
Module.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             __DIR__ . '/config/module.config.routes.php',
26 26
             __DIR__ . '/config/module.config.servicemanager.php',
27 27
         );
28
-        foreach($configFiles as $configFile) {
28
+        foreach ($configFiles as $configFile) {
29 29
             $config = \Zend\Stdlib\ArrayUtils::merge($config, include $configFile);
30 30
         }
31 31
         return $config;
@@ -43,25 +43,25 @@  discard block
 block discarded – undo
43 43
 
44 44
     public function onBootstrap($e)
45 45
     {
46
-        if($e->getRequest() instanceof \Zend\Console\Request){
46
+        if ($e->getRequest() instanceof \Zend\Console\Request) {
47 47
             return;
48 48
         }
49 49
 
50 50
         $app = $e->getParam('application');
51 51
 
52
-        $locator  = $app->getServiceManager();
52
+        $locator = $app->getServiceManager();
53 53
         $this->setServiceManager($locator);
54 54
 
55
-        $em  = $app->getEventManager()->getSharedManager();
55
+        $em = $app->getEventManager()->getSharedManager();
56 56
 
57
-        $em->attach('ImageUploader\Service\Uploader', 'fileupload.pre',  array('SpeckCatalog\Event\FileUpload', 'preFileUpload'));
57
+        $em->attach('ImageUploader\Service\Uploader', 'fileupload.pre', array('SpeckCatalog\Event\FileUpload', 'preFileUpload'));
58 58
         $em->attach('ImageUploader\Service\Uploader', 'fileupload.post', array('SpeckCatalog\Event\FileUpload', 'postFileUpload'));
59 59
 
60
-        $em->attach('SpeckCatalog\Service\ProductUom', 'insert.post', function ($e) {
60
+        $em->attach('SpeckCatalog\Service\ProductUom', 'insert.post', function($e) {
61 61
             $eventClass = new Event\FrontendEnabled;
62 62
             $eventClass->insertProductUom($e);
63 63
         });
64
-        $em->attach('SpeckCatalog\Service\ProductUom', 'update.post', function ($e) {
64
+        $em->attach('SpeckCatalog\Service\ProductUom', 'update.post', function($e) {
65 65
             $eventClass = new Event\FrontendEnabled;
66 66
             $eventClass->updateProductUom($e);
67 67
         });
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $em->attach('SpeckCatalog\Service\Product', 'insert.post', array('SpeckCatalog\Event\FrontendEnabled', 'insertProduct'));
70 70
 
71 71
         //install event listeners
72
-        $em->attach('SpeckInstall\Controller\InstallController', 'install.create_tables.post', array($this, 'constraints'),1);
72
+        $em->attach('SpeckInstall\Controller\InstallController', 'install.create_tables.post', array($this, 'constraints'), 1);
73 73
     }
74 74
 
75 75
     public function constraints($e)
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
 
80 80
             //check dependencies
81 81
             $tables = $mapper->query("show tables like 'contact_company'");
82
-            if(!count($tables)) {
82
+            if (!count($tables)) {
83 83
                 return array(false, 'SpeckCatalog could not add table constraints - missing table contact_company from SpeckContact');
84 84
             }
85 85
             $tables = $mapper->query("show tables like 'catalog_product'");
86
-            if(!count($tables)) {
86
+            if (!count($tables)) {
87 87
                 return array(false, 'SpeckCatalog could not add table constraints - missing tables provided by SpeckCatalog');
88 88
             }
89 89
 
90
-            $alter = file_get_contents(__DIR__ .'/data/alter.sql');
90
+            $alter = file_get_contents(__DIR__ . '/data/alter.sql');
91 91
             $mapper->query($alter);
92 92
 
93 93
         } catch (\Exception $e) {
Please login to merge, or discard this patch.
config/services/servicemanager.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,37 +4,37 @@  discard block
 block discarded – undo
4 4
         'speckcatalog_image_mapper' => false,
5 5
     ),
6 6
     'factories' => array(
7
-        'speckcatalog_category_service'     => function ($sm) {
7
+        'speckcatalog_category_service'     => function($sm) {
8 8
             $service = new \SpeckCatalog\Service\Category;
9 9
             $domain  = $sm->get('multisite_domain_data');
10 10
             $service->setSiteId($domain['website_id']);
11 11
             return $service->setSiteId($domain['website_id']);
12 12
         },
13
-        'speckcatalog_product_image_service' => function ($sm) {
13
+        'speckcatalog_product_image_service' => function($sm) {
14 14
             $service = new \SpeckCatalog\Service\Image;
15 15
             $mapper  = $sm->get('speckcatalog_image_mapper')->setParentType('product');
16 16
             return $service->setEntityMapper($mapper);
17 17
         },
18
-        'speckcatalog_option_image_service' => function ($sm) {
18
+        'speckcatalog_option_image_service' => function($sm) {
19 19
             $service = new \SpeckCatalog\Service\Image;
20 20
             $mapper  = $sm->get('speckcatalog_image_mapper')->setParentType('option');
21 21
             return $service->setEntityMapper($mapper);
22 22
         },
23
-        'speckcatalog_module_options' => function ($sm) {
23
+        'speckcatalog_module_options' => function($sm) {
24 24
             $config = $sm->get('Config');
25 25
             return new \SpeckCatalog\Options\ModuleOptions(isset($config['speckcatalog']) ? $config['speckcatalog'] : array());
26 26
         },
27
-        'speckcatalog_availability_form' => function ($sm) {
27
+        'speckcatalog_availability_form' => function($sm) {
28 28
             $form = new \SpeckCatalog\Form\Availability;
29 29
             $form->setCompanyService($sm->get('speckcatalog_company_service'));
30 30
             return $form->init();
31 31
         },
32
-        'speckcatalog_product_form' => function ($sm) {
32
+        'speckcatalog_product_form' => function($sm) {
33 33
             $form = new \SpeckCatalog\Form\Product;
34 34
             $form->setCompanyService($sm->get('speckcatalog_company_service'));
35 35
             return $form->init();
36 36
         },
37
-        'speckcatalog_product_uom_form' => function ($sm) {
37
+        'speckcatalog_product_uom_form' => function($sm) {
38 38
             $form = new \SpeckCatalog\Form\ProductUom;
39 39
             $form->setUomService($sm->get('speckcatalog_uom_service'));
40 40
             return $form->init();
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
         'speckcatalog_db' => 'Zend\Db\Adapter\Adapter',
45 45
     ),
46 46
     'initializers' => array(
47
-        function($instance, $sm){
48
-            if($instance instanceof \SpeckCatalog\Mapper\DbAdapterAwareInterface){
47
+        function($instance, $sm) {
48
+            if ($instance instanceof \SpeckCatalog\Mapper\DbAdapterAwareInterface) {
49 49
                 $dbAdapter = $sm->get('speckcatalog_db');
50 50
                 $instance->setDbAdapter($dbAdapter);
51 51
             }
Please login to merge, or discard this patch.
config/services/viewhelpers.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         'class'                      => 'SpeckCatalog\View\Helper\CssClass',
17 17
     ),
18 18
     'factories' => array(
19
-        'speckCatalogProduct'   => function ($sm) {
19
+        'speckCatalogProduct'   => function($sm) {
20 20
             $sm = $sm->getServiceLocator();
21 21
             $helper = new \SpeckCatalog\View\Helper\Product();
22 22
             $helper->setProductUomService($sm->get('speckcatalog_product_uom_service'));
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
             $helper->setPartialDir($options->getCatalogManagerPartialDir());
30 30
             return $helper;
31 31
         },
32
-        'speckCatalogOptionImageUploader' => function ($sm) {
32
+        'speckCatalogOptionImageUploader' => function($sm) {
33 33
             $imageUploader = $sm->get('imageUploader');
34 34
             $element = array('name' => 'file_type', 'attributes' => array('value' => 'optionImage', 'type' => 'hidden'));
35 35
             $imageUploader->getForm()->add($element);
36 36
             return $imageUploader;
37 37
         },
38
-        'speckCatalogManagerSideNav' => function ($sm) {
38
+        'speckCatalogManagerSideNav' => function($sm) {
39 39
             $sm = $sm->getServiceLocator();
40 40
             $app = $sm->get('application');
41 41
             $routeMatch = $app->getMvcEvent()->getRouteMatch();
@@ -43,36 +43,36 @@  discard block
 block discarded – undo
43 43
             $helper->setRouteMatch($routeMatch);
44 44
             return $helper;
45 45
         },
46
-        'speckCatalogProductImageUploader' => function ($sm) {
46
+        'speckCatalogProductImageUploader' => function($sm) {
47 47
             $imageUploader = $sm->get('imageUploader');
48 48
             $element = array('name' => 'file_type', 'attributes' => array('value' => 'productImage', 'type' => 'hidden'));
49 49
             $imageUploader->getForm()->add($element);
50 50
             return $imageUploader;
51 51
         },
52
-        'speckCatalogProductDocumentUploader' => function ($sm) {
52
+        'speckCatalogProductDocumentUploader' => function($sm) {
53 53
             $uploader = $sm->get('imageUploader');
54 54
             $element = array('name' => 'file_type', 'attributes' => array('value' => 'productDocument', 'type' => 'hidden'));
55 55
             $uploader->getForm()->add($element);
56 56
             return $uploader;
57 57
         },
58
-        'speckCatalogCategoryNav' => function ($sm) {
58
+        'speckCatalogCategoryNav' => function($sm) {
59 59
             $sm = $sm->getServiceLocator();
60 60
             $helper = new Helper\CategoryNav;
61 61
             return $helper->setCategoryService($sm->get('speckcatalog_category_service'));
62 62
         },
63
-        'speckCatalogImage' => function ($sm) {
63
+        'speckCatalogImage' => function($sm) {
64 64
             $sm = $sm->getServiceLocator();
65 65
             $settings = $sm->get('speckcatalog_module_options');
66 66
             return new Helper\MediaUrl($settings, 'image');
67 67
         },
68
-        'speckCatalogFeaturedProducts' => function ($sm) {
68
+        'speckCatalogFeaturedProducts' => function($sm) {
69 69
             $speckFeaturedProducts = $sm->get('speckFeaturedProducts');
70 70
             return $speckFeaturedProducts->setTemplate('/speck-catalog/product/feature-clip');
71 71
         },
72 72
     ),
73 73
     'initializers' => array(
74
-        function($instance, $sm){
75
-            if($instance instanceof FormServiceAwareInterface){
74
+        function($instance, $sm) {
75
+            if ($instance instanceof FormServiceAwareInterface) {
76 76
                 $sm = $sm->getServiceLocator();
77 77
                 $formService = $sm->get('speckcatalog_form_service');
78 78
                 $instance->setFormService($formService);
Please login to merge, or discard this patch.
src/SpeckCatalog/Adapter/PaginatorDbSelect.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     public function getItems($a, $b)
10 10
     {
11
-        $items=parent::getItems($a, $b);
11
+        $items = parent::getItems($a, $b);
12 12
         $return = array();
13 13
         foreach ($items as $item) {
14 14
             $return[] = $item;
Please login to merge, or discard this patch.
src/SpeckCatalog/Controller/CategoryController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
         $offset = ((($page * $perPage) - $perPage) + 1); //this is the first item on the page
78 78
 
79 79
         $paginatorVars['p'] = floor($offset / $_GET['nn']) + 1; //new page number
80
-        $paginatorVars['n'] = $_GET['nn'];                      //new items per page
80
+        $paginatorVars['n'] = $_GET['nn']; //new items per page
81 81
 
82 82
         $query = '?' . http_build_query($paginatorVars);
83 83
 
Please login to merge, or discard this patch.
src/SpeckCatalog/Form/AbstractForm.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      * flag is set to false if edit() has been called,
14 14
      * to differentiate between a form for a new record, or an existing record.
15 15
      */
16
-    protected $new=true;
16
+    protected $new = true;
17 17
 
18 18
     /*
19 19
      * automatically set the hydrator for the form
Please login to merge, or discard this patch.