本文整理匯總了PHP中Guzzle\Service\Command\OperationCommand::build方法的典型用法代碼示例。如果您正苦於以下問題:PHP OperationCommand::build方法的具體用法?PHP OperationCommand::build怎麽用?PHP OperationCommand::build使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Guzzle\Service\Command\OperationCommand
的用法示例。
在下文中一共展示了OperationCommand::build方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: build
/**
* {@inheritdoc}
*/
protected function build()
{
parent::build();
// json responses have the "text/javascript; charset=UTF-8" content type ...
if ('json' === $this->get('format')) {
$this->set('command.expects', 'application/json');
}
}
示例2: build
public function build()
{
parent::build();
$client = $this->getClient();
$username = $client->getUsername();
$password = $client->getPassword();
$this->request = $this->getRequestSerializer()->prepare($this);
$this->request->addPostFields(array('user' => $username, 'pass' => $password));
}
示例3: build
/**
* Create the request object that will carry out the command
*/
protected function build()
{
parent::build();
// This request needs the master secret
$user = $this->getClient()->getConfig()->get('appKey');
$pass = $this->getClient()->getConfig()->get('appMasterSecret');
$this->request->setAuth($user, $pass);
if (!$this->request->hasHeader('Content-Type')) {
$this->request->setHeader('Content-Type', $this->jsonContentType);
}
$payload = $this->assemblePayload();
$this->request->setBody(json_encode($payload));
}
示例4: build
/**
* {@inheritdoc}
*/
protected function build()
{
parent::build();
// Ensure that the body of the request ALWAYS includes some JSON. By default, this is an empty object.
if (!$this->request->getBody()) {
$this->request->setBody('{}');
}
// Never send the Expect header when interacting with a JSON query service
$this->request->removeHeader('Expect');
// Always send JSON requests as a raw string rather than using streams to avoid issues with
// cURL error code 65: "necessary data rewind wasn't possible".
// This could be removed after PHP addresses https://bugs.php.net/bug.php?id=47204
$this->request->getCurlOptions()->set(CurlHandle::BODY_AS_STRING, true);
}
示例5: build
/**
* {@inheritdoc}
*/
protected function build()
{
// By default, JSON commands with AWS require no response model processing
if ($this->operation->getResponseType() == OperationInterface::TYPE_MODEL && $this->get(self::RESPONSE_PROCESSING) == self::TYPE_MODEL) {
$this->responseParser = $this->get('command.model_processing') ? OperationResponseParser::getInstance() : NoTranslationOperationResponseParser::getInstance();
} else {
$this->responseParser = DefaultResponseParser::getInstance();
}
parent::build();
// Ensure that the body of the request ALWAYS includes some JSON. By default, this is an empty object.
if (!$this->request->getBody()) {
$this->request->setBody('{}');
}
// Never send the Expect header when interacting with a JSON query service
$this->request->removeHeader('Expect');
}
示例6: build
/**
* {@inheritdoc}
*/
protected function build()
{
parent::build();
$this->request->getQuery()->set('token', $this->getClient()->getConfig('token'));
}