/** * {@inheritDoc} */ protected function process() { parent::process(); // Execute as normally if includeChildren is false if (!$this->get('includeChildren') || null === $this->get('includeChildren')) { return; } $results = $this->getResult(); $labelId = $this->get('labelId'); $labelsChildren = $this->getClient()->getCommand('GetLabelsChildren', array('labelId' => $labelId))->execute(); if (count($labelsChildren['items']) > 0) { // Loop through all of a label's children and retrieve any child assets foreach ($labelsChildren['items'] as $childKey => $childLabel) { $childAssets = $this->getAssetsByLabelId($childLabel['id']); // Make pagination available for some of the child label's if (null !== $childAssets['next_page']) { $results['next_page'][$childLabel['id']] = $childAssets['next_page']; } // Append child's assets to original result array foreach ($childAssets['items'] as $childAsset) { $results['items'][] = $childAsset; } } } $this->setResult($results); }
/** * {@inheritdoc} */ protected function process() { parent::process(); if (strpos($this->getResponse()->getBody(true), '<?xml') !== false) { $body = $this->getResponse()->getBody(true); $body = preg_replace('# xmlns=[^ >]*#', '', $body); $this->result = new \SimpleXMLElement($body); } if ($this->result instanceof \SimpleXMLElement) { // @codeCoverageIgnoreStart if (empty($this->resultNode)) { $resultNode = $this->action . 'Result'; } else { $resultNode = $this->resultNode; } // @codeCoverageIgnoreEnd if ($resultNode != '.') { $this->result = $this->result->{$resultNode}; } // Iterable result if ($this instanceof AbstractIterableMwsCommand || $this instanceof AbstractIterableMwsOrderCommand) { $nextCommand = Inflector::snake($this->action . 'ByNextToken'); $records = $this->result; if ($this->recordPath) { $records = $this->result->xpath($this->recordPath); } // Get next token unless HasNext property is set to false if (!isset($this->result->NextToken)) { $nextToken = null; } elseif (!empty($this->result->HasNext)) { if ($this->result->HasNext == 'false') { $nextToken = null; } } $this->result = new ResultIterator($this->getClient(), array('next_token' => $nextToken, 'next_command' => $nextCommand, 'resources' => $records, 'result_node' => $resultNode, 'record_path' => $this->recordPath)); } else { if (!empty($this->recordPath)) { $this->result = $this->result->xpath($this->recordPath); } } } else { if ($this->result->getContentType() == 'application/octet-stream') { // Get CSV data array $this->result = new CsvReport($this->getResponse()->getBody(true)); } } }