Completed
Push — master ( b26934...7f62ea )
by Jonas
15s
created
Controllers/Backend/Connect.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
      */
277 277
     public function getExportListAction()
278 278
     {
279
-        $filter = (array) $this->Request()->getParam('filter', []);
279
+        $filter = (array)$this->Request()->getParam('filter', []);
280 280
         $order = reset($this->Request()->getParam('sort', []));
281 281
 
282 282
         $criteria = new SearchCriteria([
283
-            'offset' => (int) $this->Request()->getParam('start'),
284
-            'limit' => (int) $this->Request()->getParam('limit'),
283
+            'offset' => (int)$this->Request()->getParam('start'),
284
+            'limit' => (int)$this->Request()->getParam('limit'),
285 285
             'orderBy' => $order['property'],
286 286
             'orderByDirection' => $order['direction'],
287 287
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
      */
328 328
     public function getImportListAction()
329 329
     {
330
-        $filter = (array) $this->Request()->getParam('filter', []);
330
+        $filter = (array)$this->Request()->getParam('filter', []);
331 331
         $sort = $this->Request()->getParam('sort', []);
332 332
 
333 333
         foreach ($sort as $key => $currentSorter) {
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
         // Sort the categories ascending by their level, so parent categories can be imported first
547 547
         uasort(
548 548
             $categoriesToImport,
549
-            function ($a, $b) {
549
+            function($a, $b) {
550 550
                 $a = $a['level'];
551 551
                 $b = $b['level'];
552 552
                 if ($a == $b) {
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 
870 870
         // Pop IDs from result rows
871 871
         return array_map(
872
-            function ($row) {
872
+            function($row) {
873 873
                 return array_pop($row);
874 874
             },
875 875
             $result
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
         $batchsize = $this->Request()->getPost('batchsize');
959 959
         $offset = $this->Request()->getPost('offset');
960 960
         try {
961
-            $this->getHelper()->recreateConnectCategories((int) $offset, (int) $batchsize);
961
+            $this->getHelper()->recreateConnectCategories((int)$offset, (int)$batchsize);
962 962
             $this->View()->assign([
963 963
                 'success' => true,
964 964
             ]);
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
         $batchsize = $this->Request()->getPost('batchsize');
979 979
         $offset = $this->Request()->getPost('offset');
980 980
         try {
981
-            $this->getHelper()->addShopIdToConnectCategories((int) $offset, (int) $batchsize);
981
+            $this->getHelper()->addShopIdToConnectCategories((int)$offset, (int)$batchsize);
982 982
             $this->View()->assign([
983 983
                 'success' => true,
984 984
             ]);
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
             'SELECT DISTINCT `command` FROM `s_plugin_connect_log`'
1265 1265
         );
1266 1266
 
1267
-        $data = array_map(function ($column) {
1267
+        $data = array_map(function($column) {
1268 1268
             return $column['command'];
1269 1269
         }, $data);
1270 1270
 
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
     public function assignProductsToCategoryAction()
1371 1371
     {
1372 1372
         $articleIds = $this->Request()->getParam('ids');
1373
-        $categoryId = (int) $this->Request()->getParam('category');
1373
+        $categoryId = (int)$this->Request()->getParam('category');
1374 1374
 
1375 1375
         /** @var Category $category */
1376 1376
         $category = $this->getCategoryModelById($categoryId);
Please login to merge, or discard this patch.
Components/CategoryResolver.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * Returns array with category entities
54 54
      * if they don't exist will be created
55 55
      *
56
-     * @param array $categories
56
+     * @param string[] $categories
57 57
      * @param int $shopId
58 58
      * @return \Shopware\Models\Category\Category[]
59 59
      */
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
     /**
103 103
      * @param RemoteCategory[] $remoteCategories
104
-     * @param $articleId
104
+     * @param integer $articleId
105 105
      */
106 106
     private function addProductToRemoteCategory(array $remoteCategories, $articleId)
107 107
     {
Please login to merge, or discard this patch.
Components/Helper.php 2 patches
Doc Comments   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -141,6 +141,10 @@  discard block
 block discarded – undo
141 141
         return $this->manager->getRepository(ProductDetail::class)->findOneBy(['number' => $number]);
142 142
     }
143 143
 
144
+    /**
145
+     * @param string $sourceId
146
+     * @param string $shopId
147
+     */
144 148
     public function getConnectArticleModel($sourceId, $shopId)
145 149
     {
146 150
         $builder = $this->manager->createQueryBuilder();
@@ -267,9 +271,9 @@  discard block
 block discarded – undo
267 271
     /**
268 272
      * Returns a remote connectProduct e.g. for checkout maniputlations
269 273
      *
270
-     * @param array $ids
274
+     * @param string[] $ids
271 275
      * @param int $shopId
272
-     * @return array
276
+     * @return Product[]
273 277
      */
274 278
     public function getRemoteProducts(array $ids, $shopId)
275 279
     {
@@ -279,7 +283,7 @@  discard block
 block discarded – undo
279 283
     /**
280 284
      * Returns a local connectProduct for export
281 285
      *
282
-     * @param array $sourceIds
286
+     * @param string[] $sourceIds
283 287
      * @return Product[]
284 288
      */
285 289
     public function getLocalProduct(array $sourceIds)
@@ -523,7 +527,7 @@  discard block
 block discarded – undo
523 527
     /**
524 528
      * Defines the update flags
525 529
      *
526
-     * @return array
530
+     * @return string[]
527 531
      */
528 532
     public function getUpdateFlags()
529 533
     {
@@ -908,7 +912,7 @@  discard block
 block discarded – undo
908 912
 
909 913
     /**
910 914
      * @param $categoryKey
911
-     * @param $shopId
915
+     * @param integer $shopId
912 916
      * @param $category
913 917
      * @param $row
914 918
      */
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $query = $builder->getQuery();
85 85
 
86 86
         $query->setParameter('shopId', $product->shopId);
87
-        $query->setParameter('sourceId', (string) $product->sourceId);
87
+        $query->setParameter('sourceId', (string)$product->sourceId);
88 88
         $result = $query->getResult(
89 89
             $mode
90 90
         );
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
         $query = $builder->getQuery();
116 116
         $query->setParameter('shopId', $product->shopId);
117
-        $query->setParameter('sourceId', (string) $product->sourceId);
117
+        $query->setParameter('sourceId', (string)$product->sourceId);
118 118
 
119 119
         $result = $query->getResult(
120 120
             $mode
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         $query = $builder->getQuery();
155 155
 
156 156
         $query->setParameter('shopId', $shopId);
157
-        $query->setParameter('sourceId', (string) $sourceId);
157
+        $query->setParameter('sourceId', (string)$sourceId);
158 158
         $result = $query->getResult(
159 159
             $query::HYDRATE_OBJECT
160 160
         );
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             ->execute()
184 184
             ->fetchAll();
185 185
 
186
-        return array_map(function ($row) {
186
+        return array_map(function($row) {
187 187
             return $row['articleId'];
188 188
         }, $rows);
189 189
     }
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
     public function generateSourceId(ProductDetail $detail)
489 489
     {
490 490
         if ($detail->getKind() == 1) {
491
-            $sourceId = (string) $detail->getArticle()->getId();
491
+            $sourceId = (string)$detail->getArticle()->getId();
492 492
         } else {
493 493
             $sourceId = sprintf(
494 494
                 '%s-%s',
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
             }
577 577
 
578 578
             if ($p->attributes['ref_quantity']) {
579
-                $intRefQuantity = (int) $p->attributes['ref_quantity'];
579
+                $intRefQuantity = (int)$p->attributes['ref_quantity'];
580 580
                 if ($p->attributes['ref_quantity'] - $intRefQuantity <= 0.0001) {
581 581
                     $p->attributes['ref_quantity'] = $intRefQuantity;
582 582
                 }
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
      */
626 626
     public function getShopProductId($articleDetailId)
627 627
     {
628
-        $articleDetailId = (int) $articleDetailId;
628
+        $articleDetailId = (int)$articleDetailId;
629 629
         $builder = $this->manager->getConnection()->createQueryBuilder();
630 630
         $builder->select('items.source_id as sourceId, items.shop_id as shopId')
631 631
             ->from('s_plugin_connect_items', 'items')
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
      */
646 646
     public function isRemoteArticleDetail($articleDetailId)
647 647
     {
648
-        $articleDetailId = (int) $articleDetailId;
648
+        $articleDetailId = (int)$articleDetailId;
649 649
         $articleDetailRepository = $this->manager->getRepository('Shopware\Models\Article\Detail');
650 650
         /** @var \Shopware\Models\Article\Detail $detail */
651 651
         $detail = $articleDetailRepository->find($articleDetailId);
@@ -669,14 +669,14 @@  discard block
 block discarded – undo
669 669
      */
670 670
     public function isRemoteArticleDetailDBAL($articleDetailId)
671 671
     {
672
-        $articleDetailId = (int) $articleDetailId;
672
+        $articleDetailId = (int)$articleDetailId;
673 673
         $builder = $this->manager->getConnection()->createQueryBuilder();
674 674
         $builder->select('items.shop_id')
675 675
             ->from('s_plugin_connect_items', 'items')
676 676
             ->where('items.article_detail_id = :articleDetailId')
677 677
             ->setParameter(':articleDetailId', $articleDetailId);
678 678
 
679
-        return (bool) $builder->execute()->fetchColumn();
679
+        return (bool)$builder->execute()->fetchColumn();
680 680
     }
681 681
 
682 682
     /**
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
             [$articleId]
762 762
         );
763 763
 
764
-        return array_map(function ($row) {
764
+        return array_map(function($row) {
765 765
             return $row['source_id'];
766 766
         }, $rows);
767 767
     }
@@ -842,16 +842,16 @@  discard block
 block discarded – undo
842 842
                     if (!($res = $selectedCategory->fetch())) {
843 843
                         $this->manager->getConnection()->executeQuery('INSERT INTO s_plugin_connect_categories (category_key, label, shop_id) VALUES (?, ?, ?)',
844 844
                             [$categoryKey, $category, $shopId]);
845
-                        $categoryId = (int) $this->manager->getConnection()->lastInsertId();
845
+                        $categoryId = (int)$this->manager->getConnection()->lastInsertId();
846 846
                     } else {
847
-                        $categoryId = (int) $res['id'];
847
+                        $categoryId = (int)$res['id'];
848 848
                     }
849 849
                     $selectedProductToCategory = $this->manager->getConnection()->executeQuery('SELECT COUNT(*) FROM s_plugin_connect_product_to_categories WHERE connect_category_id = ? AND articleID = ?',
850
-                        [$categoryId, (int) $row['article_id']]
850
+                        [$categoryId, (int)$row['article_id']]
851 851
                     )->fetchColumn();
852
-                    if ((int) $selectedProductToCategory === 0) {
852
+                    if ((int)$selectedProductToCategory === 0) {
853 853
                         $this->manager->getConnection()->executeQuery('INSERT INTO s_plugin_connect_product_to_categories (connect_category_id, articleID) VALUES (?, ?)',
854
-                            [$categoryId, (int) $row['article_id']]
854
+                            [$categoryId, (int)$row['article_id']]
855 855
                             );
856 856
                     }
857 857
                 }
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
      */
871 871
     public function getProductCountForCategoryRecovery()
872 872
     {
873
-        return (int) $this->manager->getConnection()->executeQuery('
873
+        return (int)$this->manager->getConnection()->executeQuery('
874 874
           SELECT COUNT(*) 
875 875
           FROM (
876 876
             SELECT COUNT(*) FROM `s_plugin_connect_items` WHERE shop_id IS NOT NULL GROUP BY `article_id`
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
                 [$row['article_id']]
896 896
             );
897 897
 
898
-            $shopId = (int) $row['shop_id'];
898
+            $shopId = (int)$row['shop_id'];
899 899
             foreach ($categories as $categoryKey => $category) {
900 900
                 $this->addShopIdToConnectCategory($categoryKey, $shopId, $category, $row);
901 901
             }
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
         if (!($res = $selectedCategory->fetch())) {
922 922
             $categoryId = $this->createCategoryWithShopId($categoryKey, $shopId, $category);
923 923
         } else {
924
-            $categoryId = (int) $res['id'];
924
+            $categoryId = (int)$res['id'];
925 925
         }
926 926
         $this->manager->getConnection()->executeQuery('INSERT INTO s_plugin_connect_product_to_categories (articleID, connect_category_id) VALUES (?, ?)',
927 927
             [$row['article_id'], $categoryId]
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
         if (!($res = $selectedCategory->fetch())) {
942 942
             $this->manager->getConnection()->executeQuery('INSERT INTO s_plugin_connect_categories (category_key, label, shop_id) VALUES (?, ?, ?)',
943 943
                 [$categoryKey, $category, $shopId]);
944
-            $createdCategoryId = (int) $this->manager->getConnection()->lastInsertId();
944
+            $createdCategoryId = (int)$this->manager->getConnection()->lastInsertId();
945 945
             $this->assignLocalCategories($createdCategoryId, $categoryKey);
946 946
 
947 947
             return $createdCategoryId;
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
         $this->manager->getConnection()->executeQuery('UPDATE s_plugin_connect_categories SET shop_id = ? WHERE id = ?',
951 951
             [$shopId, $res['id']]);
952 952
 
953
-        return (int) $res['id'];
953
+        return (int)$res['id'];
954 954
     }
955 955
 
956 956
     /**
Please login to merge, or discard this patch.
Bootstrap/Update.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -503,7 +503,7 @@
 block discarded – undo
503 503
         }
504 504
     }
505 505
   
506
-  /**
506
+    /**
507 507
      * Create index by articleID in s_plugin_connect_product_to_categories table.
508 508
      */
509 509
     private function addProductToCategoryIndex()
Please login to merge, or discard this patch.