/** * Create a new model instance from a command. * * @param CommandInterface * @return array */ public static function fromCommand(CommandInterface $command) { $file = new self(); $file->setParameters($command->getResponse()->json() + array('path' => $command['path'])); $file->finishUpload(); return $file->getParameters(); }
/** * {@inheritdoc} */ public function factory(CommandInterface $originalCommand, array $data) { $command = $this->newCommand(); // set up embedded command $command->setClient($originalCommand->getClient()); $originalResponse = $originalCommand->getResponse(); $response = $this->createResponse($originalResponse, $data); $command->setResponse($response); return $command; }
/** * {@inheritdoc} */ public function before(CommandInterface $command, array &$result) { $json = $command->getResponse()->json(); // store links to use later if (array_key_exists(self::ELEMENT, $json)) { $this->set($command, 'links', $json[self::ELEMENT]); } // create new array of links which visit() adds to $result[self::ELEMENT] = array(); }
/** * {@inheritdoc} */ public function before(CommandInterface $command, array &$result) { $json = $command->getResponse()->json(); // store links to use later if (array_key_exists($this->getOutputFieldName(), $json)) { $this->set($command, $this->getFieldName(), $json[$this->getOutputFieldName()]); } // create new array of links which visit() adds to $result[$this->getOutputFieldName()] = array(); }
public function before(CommandInterface $command, array &$result) { // Set the result of the command to the array conversion of the XML body $result = json_decode(json_encode($command->getResponse()->xml()), true); }
public function before(CommandInterface $command, array &$result) { $result = json_decode(json_encode($command->getResponse()->xml()), true); }
public function before(CommandInterface $command, array &$result) { // Ensure that the result of the command is always rooted with the parsed JSON data $result = $command->getResponse()->json(); }
public function before(CommandInterface $command, array &$result) { $result = $command->getResponse()->json(); }
/** * {@inheritdoc} */ public function before(CommandInterface $command, array &$result) { // Set the result of the command to the array conversion of the XML body $result = get_object_vars($command->getResponse()->xml()); }