Completed
Push — master ( 7475e6...f11209 )
by Gilmar
22:09
created
src/Entity/Product/Manager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
     protected $entity = 'Product';
21 21
 
22 22
     protected $maps = [
23
-        'save'     => ['POST', '/products'],
24
-        'findById' => ['GET', '/products/{itemId}'],
25
-        'patch'    => ['PATCH', '/products/{itemId}'],
26
-        'update'   => ['PUT', '/products/{itemId}'],
27
-        'fetch'    => ['GET', '/products?page={offset}&size={limit}'],
23
+        'save'     => [ 'POST', '/products' ],
24
+        'findById' => [ 'GET', '/products/{itemId}' ],
25
+        'patch'    => [ 'PATCH', '/products/{itemId}' ],
26
+        'update'   => [ 'PUT', '/products/{itemId}' ],
27
+        'fetch'    => [ 'GET', '/products?page={offset}&size={limit}' ],
28 28
     ];
29 29
 
30 30
     public function save(EntityInterface $product, $route = 'save')
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
     protected function getMap($route, Product $product)
36 36
     {
37
-        return $this->factoryMap($route, ['itemId' => $product->getId()]);
37
+        return $this->factoryMap($route, [ 'itemId' => $product->getId() ]);
38 38
     }
39 39
 
40 40
 }
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
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
     {
21 21
         $app->appendCommand('product:view', 'Consulta a situação de um produto')
22 22
             ->addArgument('productId', InputArgument::REQUIRED, 'Product ID')
23
-            ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) {
24
-                $list = $app->processInputParameters([], $input, $output);
23
+            ->setCode(function(InputInterface $input, OutputInterface $output) use ($app) {
24
+                $list = $app->processInputParameters([ ], $input, $output);
25 25
 
26 26
             $p = $app->factorySdk($list)->factoryManager('product')->findById($input->getArgument('productId'));
27 27
 
28
-            $app->displayTableResults($output, [[
28
+            $app->displayTableResults($output, [ [
29 29
                 'Id'           => $p->getProductId(),
30 30
                 'Brand'        => $p->getBrand(),
31 31
                 'Department'   => $p->getDepartment(),
32 32
                 'Product Type' => $p->getProductType(),
33
-            ]]);
33
+            ] ]);
34 34
 
35 35
             $output->writeln('<fg=yellow>Skus</>');
36 36
 
@@ -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
 
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 
61 61
                 } catch (\Exception $e) {
62 62
                     $output->writeln('<error>Erro na criação</error>');
63
-                    $output->writeln('Message: <comment>'.$e->getMessage().'</comment>');
64
-                    $output->writeln('Code: <comment>'.$e->getCode().'</comment>');
63
+                    $output->writeln('Message: <comment>' . $e->getMessage() . '</comment>');
64
+                    $output->writeln('Code: <comment>' . $e->getCode() . '</comment>');
65 65
                 }
66 66
         });
67 67
 
Please login to merge, or discard this patch.