當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CommandInterface::getResult方法代碼示例

本文整理匯總了PHP中Guzzle\Service\Command\CommandInterface::getResult方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommandInterface::getResult方法的具體用法?PHP CommandInterface::getResult怎麽用?PHP CommandInterface::getResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Guzzle\Service\Command\CommandInterface的用法示例。


在下文中一共展示了CommandInterface::getResult方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: runCommand

 /**
  * @param  CommandInterface $command
  * @return EncodingResponse
  */
 protected function runCommand($command)
 {
     try {
         return $command->getResult();
     } catch (\Exception $e) {
         throw new RuntimeException('Could not run encoding.com request.', 0, $e);
     }
 }
開發者ID:phpro,項目名稱:zf-encoding-com,代碼行數:12,代碼來源:Client.php

示例2: processResponse

 /**
  * Process the response of the DeleteMultipleObjects request
  *
  * @paramCommandInterface $command Command executed
  */
 protected function processResponse(CommandInterface $command)
 {
     $result = $command->getResult();
     // Ensure that the objects were deleted successfully
     if (!empty($result['Errors'])) {
         $errors = $result['Errors'];
         throw new DeleteMultipleObjectsException($errors);
     }
 }
開發者ID:ChengHuaUESTC,項目名稱:mssapi_php,代碼行數:14,代碼來源:DeleteObjectsTransfer.php

示例3: execute

 /**
  * Execute a command and return the response
  *
  * @param CommandInterface|CommandSet|array $command Command or set to execute
  *
  * @return mixed Returns the result of the executed command's
  *       {@see CommandInterface::getResult} method if a CommandInterface is
  *       passed, or the CommandSet itself if a CommandSet is passed
  * @throws InvalidArgumentException if an invalid command is passed
  * @throws CommandSetException if a set contains commands associated with other clients
  */
 public function execute($command)
 {
     if ($command instanceof CommandInterface) {
         $request = $command->setClient($this)->prepare();
         $this->dispatch('command.before_send', array('command' => $command));
         // Set the state to new if the command was previously executed
         if ($request->getState() !== RequestInterface::STATE_NEW) {
             $request->setState(RequestInterface::STATE_NEW);
         }
         $request->send();
         $this->dispatch('command.after_send', array('command' => $command));
         return $command->getResult();
     } elseif ($command instanceof CommandSet) {
         foreach ($command as $c) {
             if ($c->getClient() && $c->getClient() !== $this) {
                 throw new CommandSetException('Attempting to run a mixed-Client CommandSet from a ' . 'Client context.  Run the set using CommandSet::execute() ');
             }
             $c->setClient($this);
         }
         return $command->execute();
     } elseif (is_array($command)) {
         return $this->execute(new CommandSet($command));
     }
     throw new InvalidArgumentException('Invalid command sent to ' . __METHOD__);
 }
開發者ID:norv,項目名稱:guzzle,代碼行數:36,代碼來源:Client.php


注:本文中的Guzzle\Service\Command\CommandInterface::getResult方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。