本文整理汇总了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'));
}