Completed
Pull Request — master (#1)
by Gilmar
45:47 queued 20:39
created
src/Console/Application.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
         ],
28 28
         [
29 29
             'key'     => 'env',
30
-            'options' => ['sandbox', 'api'],
30
+            'options' => [ 'sandbox', 'api' ],
31 31
             'default' => 'sandbox',
32 32
             'name'    => 'Version',
33 33
         ],
34 34
         [
35 35
             'key'     => 'sslVersion',
36
-            'options' => ['SecureTransport', 'TLS'],
36
+            'options' => [ 'SecureTransport', 'TLS' ],
37 37
             'default' => 'SecureTransport',
38 38
             'name'    => 'SSL Version',
39 39
         ],
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 
46 46
     public function factorySdk(array $options)
47 47
     {
48
-        $options['version'] = $options['env'];
48
+        $options[ 'version' ] = $options[ 'env' ];
49 49
 
50 50
         return  Factory::getInstance()->setup($options, $this->factoryLogger());
51 51
     }
52 52
 
53
-    public function appendCommand($name, $description, array $definition = [])
53
+    public function appendCommand($name, $description, array $definition = [ ])
54 54
     {
55 55
         return $this->register($name)
56 56
             ->setDescription($description)
Please login to merge, or discard this patch.
src/Entity/Templates/Manager.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,12 +19,12 @@
 block discarded – undo
19 19
     protected $entity = 'Templates';
20 20
 
21 21
     public $maps = [
22
-        'brands' => ['GET', '/brands'],
23
-        'flavors' => ['GET', '/flavors'],
24
-        'colors' => ['GET', '/colors'],
25
-        'sizes' => ['GET', '/sizes'],
26
-        'departments' => ['GET', '/bus/{buId}/departments'],
27
-        'productTypes' => ['GET', '/department/{departmentCode}/productType'],
28
-        'attributes' => ['GET', '/department/{departmentCode}/productType/{productTypeCode}/templates'],
22
+        'brands' => [ 'GET', '/brands' ],
23
+        'flavors' => [ 'GET', '/flavors' ],
24
+        'colors' => [ 'GET', '/colors' ],
25
+        'sizes' => [ 'GET', '/sizes' ],
26
+        'departments' => [ 'GET', '/bus/{buId}/departments' ],
27
+        'productTypes' => [ 'GET', '/department/{departmentCode}/productType' ],
28
+        'attributes' => [ 'GET', '/department/{departmentCode}/productType/{productTypeCode}/templates' ],
29 29
     ];
30 30
 }
Please login to merge, or discard this patch.
src/Entity/AbstractMetadata.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@
 block discarded – undo
20 20
 
21 21
     protected function normalizeMetas($metas)
22 22
     {
23
-        $data = [];
23
+        $data = [ ];
24 24
 
25 25
         if (is_array($metas)) {
26 26
             foreach ($metas as $meta) {
27
-                $data[$meta['rel']] = str_replace('http://sandbox-catalogo-vs.netshoes.local/mp-catalogo-api/rs', '', $meta['href']);
27
+                $data[ $meta[ 'rel' ] ] = str_replace('http://sandbox-catalogo-vs.netshoes.local/mp-catalogo-api/rs', '', $meta[ 'href' ]);
28 28
             }
29 29
         }
30 30
 
Please login to merge, or discard this patch.
src/Console/Command/ProductCommand.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
     {
22 22
         $app->appendCommand('product:view', 'Consulta a situação de um produto')
23 23
             ->addArgument('productId', InputArgument::REQUIRED, 'Product ID')
24
-            ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) {
25
-                $list = $app->processInputParameters([], $input, $output);
24
+            ->setCode(function(InputInterface $input, OutputInterface $output) use ($app) {
25
+                $list = $app->processInputParameters([ ], $input, $output);
26 26
 
27 27
                 $p = $app->factorySdk($list)->factoryManager('product')->findById($input->getArgument('productId'));
28 28
 
29
-                $app->displayTableResults($output, [[
29
+                $app->displayTableResults($output, [ [
30 30
                 'Id' => $p->getProductId(),
31 31
                 'Brand' => $p->getBrand(),
32 32
                 'Department' => $p->getDepartment(),
33 33
                 'Product Type' => $p->getProductType(),
34
-            ]]);
34
+            ] ]);
35 35
 
36 36
                 $output->writeln('<fg=yellow>Skus</>');
37 37
 
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
             });
40 40
 
41 41
         $insertOptions = [
42
-            ['key' => 'file'],
42
+            [ 'key' => 'file' ],
43 43
         ];
44 44
 
45 45
         $app->appendCommand('product:insert', 'Insere um produto a partir do Json de um arquivo')
46 46
             ->setDefinition($app->factoryDefinition($insertOptions))
47
-            ->setCode(function (InputInterface $input, OutputInterface $output) use ($app, $insertOptions) {
47
+            ->setCode(function(InputInterface $input, OutputInterface $output) use ($app, $insertOptions) {
48 48
                 $list = $app->processInputParameters($insertOptions, $input, $output);
49 49
 
50
-                $data = json_decode(file_get_contents($list['file']), true);
50
+                $data = json_decode(file_get_contents($list[ 'file' ]), true);
51 51
                 $sdk = $app->factorySdk($list);
52 52
                 $product = $sdk->createProduct($data);
53 53
 
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
                     }
60 60
                 } catch (\Exception $e) {
61 61
                     $output->writeln('<error>Erro na criação</error>');
62
-                    $output->writeln('Message: <comment>'.$e->getMessage().'</comment>');
63
-                    $output->writeln('Code: <comment>'.$e->getCode().'</comment>');
62
+                    $output->writeln('Message: <comment>' . $e->getMessage() . '</comment>');
63
+                    $output->writeln('Code: <comment>' . $e->getCode() . '</comment>');
64 64
                 }
65 65
             });
66 66
 
Please login to merge, or discard this patch.
src/Console/Command/TemplatesCommand.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
             'colors',
26 26
             'sizes',
27 27
         ] as $templateKey) {
28
-            $app->appendCommand('templates:'.$templateKey, 'List of '.$templateKey)
29
-                ->setCode(function (InputInterface $input, OutputInterface $output) use ($app, $templateKey) {
30
-                    $list = $app->processInputParameters([], $input, $output);
28
+            $app->appendCommand('templates:' . $templateKey, 'List of ' . $templateKey)
29
+                ->setCode(function(InputInterface $input, OutputInterface $output) use ($app, $templateKey) {
30
+                    $list = $app->processInputParameters([ ], $input, $output);
31 31
                     $responseList = $app->factorySdk($list)->factoryManager('templates')->fetchByRoute($templateKey);
32 32
                     $app->displayTableResults($output, $responseList);
33 33
                 });
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 
36 36
         $app->appendCommand('templates:departments', 'List of departments')
37 37
             ->addArgument('buId', InputArgument::REQUIRED, 'Business unit id - NS = Netshoes e ZT = Zattini')
38
-            ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) {
39
-                $list = $app->processInputParameters([], $input, $output);
38
+            ->setCode(function(InputInterface $input, OutputInterface $output) use ($app) {
39
+                $list = $app->processInputParameters([ ], $input, $output);
40 40
                 $responseList = $app->factorySdk($list)->factoryManager('templates')
41 41
                     ->fetchByRoute('departments', 0, 50, [
42 42
                         'buId' => $input->getArgument('buId'),
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
         $app->appendCommand('templates:productTypes', 'List of productTypes')
48 48
             ->addArgument('departmentCode', InputArgument::REQUIRED, 'Id do departamento')
49
-            ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) {
50
-                $list = $app->processInputParameters([], $input, $output);
49
+            ->setCode(function(InputInterface $input, OutputInterface $output) use ($app) {
50
+                $list = $app->processInputParameters([ ], $input, $output);
51 51
                 $responseList = $app->factorySdk($list)->factoryManager('templates')
52 52
                     ->fetchByRoute('productTypes', 0, 50, [
53 53
                         'departmentCode' => $input->getArgument('departmentCode'),
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
         $app->appendCommand('templates:attributes', 'List of attributes')
59 59
             ->addArgument('departmentCode', InputArgument::REQUIRED, 'Id do departamento')
60 60
             ->addArgument('productTypeCode', InputArgument::REQUIRED, 'Id do Product Type')
61
-            ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) {
62
-                $list = $app->processInputParameters([], $input, $output);
61
+            ->setCode(function(InputInterface $input, OutputInterface $output) use ($app) {
62
+                $list = $app->processInputParameters([ ], $input, $output);
63 63
                 $responseList = $app->factorySdk($list)->factoryManager('templates')
64 64
                     ->fetchByRoute('attributes', 0, 50, [
65 65
                         'departmentCode' => $input->getArgument('departmentCode'),
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 
71 71
         $app->appendCommand('templates:tree', 'Tree of templates')
72 72
             ->addArgument('buId', InputArgument::REQUIRED, 'Business unit id - NS = Netshoes e ZT = Zattini')
73
-            ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) {
74
-                $list = $app->processInputParameters([], $input, $output);
73
+            ->setCode(function(InputInterface $input, OutputInterface $output) use ($app) {
74
+                $list = $app->processInputParameters([ ], $input, $output);
75 75
                 $buId = $input->getArgument('buId');
76 76
                 $manager = $app->factorySdk($list)->factoryManager('templates');
77 77
 
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
                 ]);
81 81
 
82 82
                 foreach ($departaments as $departament) {
83
-                    $output->writeln('<info>'.$departament->getId().'</info> '.$departament->getName());
83
+                    $output->writeln('<info>' . $departament->getId() . '</info> ' . $departament->getName());
84 84
 
85 85
                     $types = $manager->fetchByRoute('productTypes', 0, 50, [
86 86
                             'departmentCode' => $departament->getId(),
87 87
                     ]);
88 88
 
89 89
                     foreach ($types as $type) {
90
-                        $output->writeln("\t - ".'<fg=yellow>'.$type->getId().'</> '.$type->getName());
90
+                        $output->writeln("\t - " . '<fg=yellow>' . $type->getId() . '</> ' . $type->getName());
91 91
                     }
92 92
 
93 93
                     $output->writeln('<fg=yellow>------</>');
Please login to merge, or discard this patch.
src/Console/Command/SkuCommand.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
     {
22 22
         $app->appendCommand('product:sku:view', 'Mostra os SKUs de um Produto')
23 23
             ->addArgument('productId', InputArgument::REQUIRED, 'Product ID')
24
-            ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) {
25
-                $list = $app->processInputParameters([], $input, $output);
24
+            ->setCode(function(InputInterface $input, OutputInterface $output) use ($app) {
25
+                $list = $app->processInputParameters([ ], $input, $output);
26 26
 
27 27
                 $p = $app->factorySdk($list)->factoryManager('sku')->findById($input->getArgument('productId'));
28 28
 
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
             });
31 31
 
32 32
         $insertOptions = [
33
-            ['key' => 'file'],
33
+            [ 'key' => 'file' ],
34 34
         ];
35 35
 
36 36
         $app->appendCommand('product:sku:update', 'Atualiza um SKU')
37 37
             ->setDefinition($app->factoryDefinition($insertOptions))
38
-            ->setCode(function (InputInterface $input, OutputInterface $output) use ($app, $insertOptions) {
38
+            ->setCode(function(InputInterface $input, OutputInterface $output) use ($app, $insertOptions) {
39 39
                 $list = $app->processInputParameters($insertOptions, $input, $output);
40 40
 
41
-                $data = json_decode(file_get_contents($list['file']), true);
41
+                $data = json_decode(file_get_contents($list[ 'file' ]), true);
42 42
                 $sdk = $app->factorySdk($list);
43 43
                 $product = $sdk->createSku($data);
44 44
 
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
                     }
51 51
                 } catch (\Exception $e) {
52 52
                     $output->writeln('<error>Erro na criação</error>');
53
-                    $output->writeln('Message: <comment>'.$e->getMessage().'</comment>');
54
-                    $output->writeln('Code: <comment>'.$e->getCode().'</comment>');
53
+                    $output->writeln('Message: <comment>' . $e->getMessage() . '</comment>');
54
+                    $output->writeln('Code: <comment>' . $e->getCode() . '</comment>');
55 55
                 }
56 56
             });
57 57
 
Please login to merge, or discard this patch.
src/Factory.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 class Factory extends FactoryAbstract
17 17
 {
18
-    public function setClient(array $clientOptions = [])
18
+    public function setClient(array $clientOptions = [ ])
19 19
     {
20 20
         $this->client = new Client($clientOptions, $this->logger);
21 21
     }
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
     {
30 30
         return [
31 31
             'product' => [
32
-                'class' => $namespace.'Product\Product',
33
-                'manager' => $namespace.'Product\Manager',
32
+                'class' => $namespace . 'Product\Product',
33
+                'manager' => $namespace . 'Product\Manager',
34 34
             ],
35 35
             'sku' => [
36
-                'class' => $namespace.'Product\Sku\Item',
37
-                'manager' => $namespace.'Product\Sku\Manager',
36
+                'class' => $namespace . 'Product\Sku\Item',
37
+                'manager' => $namespace . 'Product\Sku\Manager',
38 38
             ],
39 39
             'templates' => [
40
-                'class' => $namespace.'Templates\Templates',
41
-                'manager' => $namespace.'Templates\Manager',
40
+                'class' => $namespace . 'Templates\Templates',
41
+                'manager' => $namespace . 'Templates\Manager',
42 42
             ],
43 43
         ];
44 44
     }
Please login to merge, or discard this patch.
src/Entity/Product/Manager.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@
 block discarded – undo
18 18
     protected $entity = 'Product';
19 19
 
20 20
     protected $maps = [
21
-        'save' => ['POST', '/products'],
22
-        'findById' => ['GET', '/products/{itemId}'],
23
-        'patch' => ['PATCH', '/products/{itemId}'],
24
-        'update' => ['PUT', '/products/{itemId}'],
25
-        'fetch' => ['GET', '/products?page={offset}&size={limit}'],
21
+        'save' => [ 'POST', '/products' ],
22
+        'findById' => [ 'GET', '/products/{itemId}' ],
23
+        'patch' => [ 'PATCH', '/products/{itemId}' ],
24
+        'update' => [ 'PUT', '/products/{itemId}' ],
25
+        'fetch' => [ 'GET', '/products?page={offset}&size={limit}' ],
26 26
     ];
27 27
 
28 28
     public function save(EntityInterface $product, $route = 'save')
Please login to merge, or discard this patch.
src/Entity/Product/Sku/Manager.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
     protected $entity = 'SkuCollection';
19 19
 
20 20
     protected $maps = [
21
-        'save' => ['POST', '/products/{productId}/skus'], //Create a new sku for a product
22
-        'findSkuById' => ['GET', '/products/{productId}/skus/{itemId}'], // Get the a sku by product Id and sku Id
23
-        'update' => ['PUT', '/products/{productId}/skus/{sku}/{itemId}'], //Update a product based on SKU
24
-        'findById' => ['GET', '/products/{itemId}/skus'], //Get the list of product skus
25
-        'saveStatus' => ['PUT', '/skus/{sku}/bus/{buId}/status'], //Enable or disable sku for sale
26
-        'savePriceSchedule' => ['POST', '/skus/{sku}/priceSchedules'], //Save a price schedule
27
-        'savePrice' => ['PUT', '/skus/{sku}/prices'], //Save a base price
28
-        'saveStock' => ['PUT', '/skus/{sku}/stocks'], //Update stock quantity by sku
21
+        'save' => [ 'POST', '/products/{productId}/skus' ], //Create a new sku for a product
22
+        'findSkuById' => [ 'GET', '/products/{productId}/skus/{itemId}' ], // Get the a sku by product Id and sku Id
23
+        'update' => [ 'PUT', '/products/{productId}/skus/{sku}/{itemId}' ], //Update a product based on SKU
24
+        'findById' => [ 'GET', '/products/{itemId}/skus' ], //Get the list of product skus
25
+        'saveStatus' => [ 'PUT', '/skus/{sku}/bus/{buId}/status' ], //Enable or disable sku for sale
26
+        'savePriceSchedule' => [ 'POST', '/skus/{sku}/priceSchedules' ], //Save a price schedule
27
+        'savePrice' => [ 'PUT', '/skus/{sku}/prices' ], //Save a base price
28
+        'saveStock' => [ 'PUT', '/skus/{sku}/stocks' ], //Update stock quantity by sku
29 29
     ];
30 30
 
31 31
     public function save(EntityInterface $product, $route = 'save')
Please login to merge, or discard this patch.