Completed
Pull Request — master (#1)
by Gilmar
45:47 queued 20:39
created
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/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.
src/Entity/ManagerAbstract.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
     protected function factoryEntityCollection($data)
37 37
     {
38
-        return $this->factoryNeighborObject($this->getEntityName().'Collection', $data);
38
+        return $this->factoryNeighborObject($this->getEntityName() . 'Collection', $data);
39 39
     }
40 40
 
41 41
     /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function update(EntityInterface $entity, EntityInterface $existent)
57 57
     {
58
-        $text = 'Chamada a Atualização de entity '.$this->entity;
58
+        $text = 'Chamada a Atualização de entity ' . $this->entity;
59 59
 
60 60
         return $this->log('debug', $text, [
61 61
             'entity' => $entity,
Please login to merge, or discard this patch.
src/Client/Client.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@
 block discarded – undo
31 31
 
32 32
     protected function renderAuthorization()
33 33
     {
34
-        $list = [];
34
+        $list = [ ];
35 35
 
36
-        foreach (['client_id', 'access_token'] as $key) {
36
+        foreach ([ 'client_id', 'access_token' ] as $key) {
37 37
             $value = $this->getOptions()->get($key);
38 38
             if (empty($value)) {
39
-                throw new \InvalidArgumentException('['.$key.'] ausente!');
39
+                throw new \InvalidArgumentException('[' . $key . '] ausente!');
40 40
             }
41 41
 
42
-            $list[] = $key.':'.$value;
42
+            $list[ ] = $key . ':' . $value;
43 43
         }
44 44
 
45 45
         return $list;
Please login to merge, or discard this patch.