@@ -34,15 +34,15 @@ |
||
34 | 34 | |
35 | 35 | protected function renderAuthorization() |
36 | 36 | { |
37 | - $list = []; |
|
37 | + $list = [ ]; |
|
38 | 38 | |
39 | - foreach (['client_id', 'access_token'] as $key) { |
|
39 | + foreach ([ 'client_id', 'access_token' ] as $key) { |
|
40 | 40 | $value = $this->getOptions()->get($key); |
41 | 41 | if (empty($value)) { |
42 | 42 | throw new \InvalidArgumentException('[' . $key . '] ausente!'); |
43 | 43 | } |
44 | 44 | |
45 | - $list[] = $key . ':' . $value; |
|
45 | + $list[ ] = $key . ':' . $value; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | return $list; |
@@ -27,13 +27,13 @@ discard block |
||
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 |
||
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) |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | class Factory extends FactoryAbstract |
20 | 20 | { |
21 | - public function setClient(array $clientOptions = []) |
|
21 | + public function setClient(array $clientOptions = [ ]) |
|
22 | 22 | { |
23 | 23 | $this->client = new Client($clientOptions, $this->logger); |
24 | 24 | } |
@@ -19,12 +19,12 @@ |
||
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 | } |
@@ -20,11 +20,11 @@ |
||
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 |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | 'sizes', |
26 | 26 | ] as $templateKey) { |
27 | 27 | $app->appendCommand('templates:' . $templateKey, 'List of ' . $templateKey) |
28 | - ->setCode(function (InputInterface $input, OutputInterface $output) use ($app, $templateKey) { |
|
29 | - $list = $app->processInputParameters([], $input, $output); |
|
28 | + ->setCode(function(InputInterface $input, OutputInterface $output) use ($app, $templateKey) { |
|
29 | + $list = $app->processInputParameters([ ], $input, $output); |
|
30 | 30 | $responseList = $app->factorySdk($list)->factoryManager('templates')->fetchByRoute($templateKey); |
31 | 31 | $app->displayTableResults($output, $responseList); |
32 | 32 | }); |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | |
35 | 35 | $app->appendCommand('templates:departments', 'List of departments') |
36 | 36 | ->addArgument('buId', InputArgument::REQUIRED, 'Business unit id - NS = Netshoes e ZT = Zattini') |
37 | - ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) { |
|
38 | - $list = $app->processInputParameters([], $input, $output); |
|
37 | + ->setCode(function(InputInterface $input, OutputInterface $output) use ($app) { |
|
38 | + $list = $app->processInputParameters([ ], $input, $output); |
|
39 | 39 | $responseList = $app->factorySdk($list)->factoryManager('templates') |
40 | 40 | ->fetchByRoute('departments', 0, 50, [ |
41 | 41 | 'buId' => $input->getArgument('buId'), |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | |
46 | 46 | $app->appendCommand('templates:productTypes', 'List of productTypes') |
47 | 47 | ->addArgument('departmentCode', InputArgument::REQUIRED, 'Id do departamento') |
48 | - ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) { |
|
49 | - $list = $app->processInputParameters([], $input, $output); |
|
48 | + ->setCode(function(InputInterface $input, OutputInterface $output) use ($app) { |
|
49 | + $list = $app->processInputParameters([ ], $input, $output); |
|
50 | 50 | $responseList = $app->factorySdk($list)->factoryManager('templates') |
51 | 51 | ->fetchByRoute('productTypes', 0, 50, [ |
52 | 52 | 'departmentCode' => $input->getArgument('departmentCode'), |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | $app->appendCommand('templates:attributes', 'List of attributes') |
58 | 58 | ->addArgument('departmentCode', InputArgument::REQUIRED, 'Id do departamento') |
59 | 59 | ->addArgument('productTypeCode', InputArgument::REQUIRED, 'Id do Product Type') |
60 | - ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) { |
|
61 | - $list = $app->processInputParameters([], $input, $output); |
|
60 | + ->setCode(function(InputInterface $input, OutputInterface $output) use ($app) { |
|
61 | + $list = $app->processInputParameters([ ], $input, $output); |
|
62 | 62 | $responseList = $app->factorySdk($list)->factoryManager('templates') |
63 | 63 | ->fetchByRoute('attributes', 0, 50, [ |
64 | 64 | 'departmentCode' => $input->getArgument('departmentCode'), |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | |
70 | 70 | $app->appendCommand('templates:tree', 'Tree of templates') |
71 | 71 | ->addArgument('buId', InputArgument::REQUIRED, 'Business unit id - NS = Netshoes e ZT = Zattini') |
72 | - ->setCode(function (InputInterface $input, OutputInterface $output) use ($app) { |
|
73 | - $list = $app->processInputParameters([], $input, $output); |
|
72 | + ->setCode(function(InputInterface $input, OutputInterface $output) use ($app) { |
|
73 | + $list = $app->processInputParameters([ ], $input, $output); |
|
74 | 74 | $buId = $input->getArgument('buId'); |
75 | 75 | $manager = $app->factorySdk($list)->factoryManager('templates'); |
76 | 76 |
@@ -20,11 +20,11 @@ discard block |
||
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 |
||
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 | } |
@@ -20,17 +20,17 @@ discard block |
||
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 |
||
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 |
||
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 |