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


PHP CommandInterface::getRequest方法代碼示例

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


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

示例1: addMd5

 private function addMd5(CommandInterface $command)
 {
     $request = $command->getRequest();
     if ($body = $request->getBody()) {
         if (false !== ($md5 = $body->getContentMd5(true, true))) {
             $request->setHeader('Content-MD5', $md5);
         }
     }
 }
開發者ID:viggi2004,項目名稱:datacollector-backend,代碼行數:9,代碼來源:S3Md5Listener.php

示例2: addMd5

 private function addMd5(CommandInterface $command)
 {
     $request = $command->getRequest();
     if ($body = $request->getBody()) {
         if (false === ($md5 = $body->getContentMd5(true, true))) {
             throw new RuntimeException('Unable to add a MD5 checksum');
         }
         $request->setHeader('Content-MD5', $md5);
     }
 }
開發者ID:iLoiLohas,項目名稱:pinchshopper,代碼行數:10,代碼來源:S3Md5Listener.php

示例3: parse

 public function parse(CommandInterface $command)
 {
     $response = $command->getRequest()->getResponse();
     if ($contentType = $command['command.expects']) {
         $response->setHeader('Content-Type', $contentType);
     } else {
         $contentType = (string) $response->getHeader('Content-Type');
     }
     return $this->handleParsing($command, $response, $contentType);
 }
開發者ID:Ryu0621,項目名稱:SaNaVi,代碼行數:10,代碼來源:DefaultResponseParser.php

示例4: fromCommand

 /**
  * {@inheritDoc}
  */
 public static function fromCommand(CommandInterface $command, Response $response)
 {
     $errors = json_decode($response->getBody(true), true);
     $type = array_get($errors, 'error.type', null);
     $code = array_get($errors, 'error.code', null);
     $message = array_get($errors, 'error.message', null);
     $class = '\\Apache\\Usergrid\\Api\\Exception\\' . studly_case($type) . 'Exception';
     if (class_exists($class)) {
         $exception = new $class($message, $response->getStatusCode());
     } else {
         $exception = new static($message, $response->getStatusCode());
     }
     $exception->setErrorType($type);
     $exception->setResponse($response);
     $exception->setRequest($command->getRequest());
     return $exception;
 }
開發者ID:funkyidol,項目名稱:usergrid,代碼行數:20,代碼來源:UsergridException.php

示例5: parse

 /**
  * {@inheritdoc}
  *
  * @param CommandInterface $command
  * @return array|MultiResultResponse|SingleResultResponse|Response|mixed
  */
 public function parse(CommandInterface $command)
 {
     $response = $command->getRequest()->getResponse();
     if ($response === null) {
         return null;
     }
     $responseArray = $this->parseResponseIntoArray($response);
     // If there is no Body, just return the Response
     if (!$response->getBody()) {
         return $response;
     }
     // Handle multi-result responses
     if (array_key_exists('results', $responseArray)) {
         return $this->createMultiResultResponse($response);
     }
     return $this->createSingleResultResponse($response);
 }
開發者ID:opdavies,項目名稱:nwdrupalwebsite,代碼行數:23,代碼來源:MeetupResponseParser.php

示例6: fromCommand

 /**
  * {@inheritDoc}
  */
 public static function fromCommand(CommandInterface $command, Response $response)
 {
     $errors = json_decode($response->getBody(true), true);
     $type = $errors['error']['type'];
     $message = isset($errors['error']['message']) ? $errors['error']['message'] : 'Unknown error';
     $code = isset($errors['error']['code']) ? $errors['error']['code'] : null;
     // We can trigger very specific exception based on the type and code
     if ($type === 'card_error') {
         $exception = new CardErrorException($message, $response->getStatusCode());
     } elseif ($type === 'invalid_request_error' && $code === 'rate_limit') {
         $exception = new ApiRateLimitException($message, $response->getStatusCode());
     } else {
         $exception = new static($message, $response->getStatusCode());
     }
     $exception->setRequest($command->getRequest());
     $exception->setResponse($response);
     return $exception;
 }
開發者ID:netglue,項目名稱:zfr-stripe,代碼行數:21,代碼來源:AbstractResponseException.php

示例7: getExceptionForFailedCommand

 /**
  * Get the Exception that caused the given $command to fail
  *
  * @param CommandInterface $command Failed command
  *
  * @return \Exception|null
  */
 public function getExceptionForFailedCommand(CommandInterface $command)
 {
     return $this->getExceptionForFailedRequest($command->getRequest());
 }
開發者ID:alvarobfdev,項目名稱:applog,代碼行數:11,代碼來源:CommandTransferException.php

示例8: parse

 /**
  * {@inheritdoc}
  */
 public function parse(CommandInterface $command)
 {
     $response = $command->getRequest()->getResponse();
     $contentType = (string) $response->getHeader('Content-Type');
     return $this->handleParsing($command, $response, $contentType);
 }
開發者ID:aciliainternet,項目名稱:guzzle-bundle,代碼行數:9,代碼來源:JMSSerializerResponseParser.php

示例9: 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) {
         $command->setClient($this)->prepare();
         $this->dispatch('command.before_send', array('command' => $command));
         $command->getRequest()->send();
         $this->dispatch('command.after_send', array('command' => $command));
         return $command->getResult();
     } else {
         if ($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();
         } else {
             if (is_array($command)) {
                 return $this->execute(new CommandSet($command));
             }
         }
     }
     throw new InvalidArgumentException('Invalid command sent to ' . __METHOD__);
 }
開發者ID:MicroSDHC,項目名稱:justinribeiro.com-examples,代碼行數:37,代碼來源:Client.php

示例10: parse

 /**
  * {@inheritdoc}
  */
 public function parse(CommandInterface $command)
 {
     $content = $command->getRequest()->getResponse()->getBody(true);
     return json_decode(preg_replace('/^availableFeeds=/', '', $content), true);
 }
開發者ID:adrienbrault,項目名稱:itunes-client,代碼行數:8,代碼來源:ListFeedsCommand.php


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