@@ -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 | } |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | protected $entity = 'Sku'; |
18 | 18 | |
19 | 19 | protected $maps = [ |
20 | - 'save' => ['POST', '/products/{productId}/skus'], //Create a new sku for a product |
|
21 | - 'findById' => ['GET', '/products/{productId}/skus/{itemId}'], // Get the a sku by product Id and sku Id |
|
22 | - 'update' => ['PUT', '/products/{productId}/skus/{sku}/{itemId}'], //Update a product based on SKU |
|
23 | - 'fetch' => ['GET', '/products/{productId}/skus?page={offset}&size={limit}'], //Get the list of product skus |
|
24 | - 'saveStatus' => ['PUT', '/skus/{sku}/bus/{buId}/status'], //Enable or disable sku for sale |
|
25 | - 'savePriceSchedule' => ['POST', '/skus/{sku}/priceSchedules'], //Save a price schedule |
|
26 | - 'savePrice' => ['PUT', '/skus/{sku}/prices'], //Save a base price |
|
27 | - 'saveStock' => ['PUT', '/skus/{sku}/stocks'], //Update stock quantity by sku |
|
20 | + 'save' => [ 'POST', '/products/{productId}/skus' ], //Create a new sku for a product |
|
21 | + 'findById' => [ 'GET', '/products/{productId}/skus/{itemId}' ], // Get the a sku by product Id and sku Id |
|
22 | + 'update' => [ 'PUT', '/products/{productId}/skus/{sku}/{itemId}' ], //Update a product based on SKU |
|
23 | + 'fetch' => [ 'GET', '/products/{productId}/skus?page={offset}&size={limit}' ], //Get the list of product skus |
|
24 | + 'saveStatus' => [ 'PUT', '/skus/{sku}/bus/{buId}/status' ], //Enable or disable sku for sale |
|
25 | + 'savePriceSchedule' => [ 'POST', '/skus/{sku}/priceSchedules' ], //Save a price schedule |
|
26 | + 'savePrice' => [ 'PUT', '/skus/{sku}/prices' ], //Save a base price |
|
27 | + 'saveStock' => [ 'PUT', '/skus/{sku}/stocks' ], //Update stock quantity by sku |
|
28 | 28 | ]; |
29 | 29 | |
30 | 30 | public function save(EntityInterface $product, $route = 'save') |
@@ -34,6 +34,6 @@ 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 | } |
@@ -18,15 +18,15 @@ |
||
18 | 18 | public static function append(Application $app) |
19 | 19 | { |
20 | 20 | $insertOptions = [ |
21 | - ['key' => 'file'], |
|
21 | + [ 'key' => 'file' ], |
|
22 | 22 | ]; |
23 | 23 | |
24 | 24 | $app->appendCommand('product:sku:update', 'Atualiza um SKU') |
25 | 25 | ->setDefinition($app->factoryDefinition($insertOptions)) |
26 | - ->setCode(function (InputInterface $input, OutputInterface $output) use ($app, $insertOptions) { |
|
26 | + ->setCode(function(InputInterface $input, OutputInterface $output) use ($app, $insertOptions) { |
|
27 | 27 | $list = $app->processInputParameters($insertOptions, $input, $output); |
28 | 28 | |
29 | - $data = json_decode(file_get_contents($list['file']), true); |
|
29 | + $data = json_decode(file_get_contents($list[ 'file' ]), true); |
|
30 | 30 | $sdk = $app->factorySdk($list); |
31 | 31 | $product = $sdk->createSku($data); |
32 | 32 |