本文整理匯總了PHP中Guzzle\Service\Command\OperationCommand::process方法的典型用法代碼示例。如果您正苦於以下問題:PHP OperationCommand::process方法的具體用法?PHP OperationCommand::process怎麽用?PHP OperationCommand::process使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Guzzle\Service\Command\OperationCommand
的用法示例。
在下文中一共展示了OperationCommand::process方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: process
/**
* Validate response model after processing
* @throws ValidationException
* @override
*/
protected function process()
{
parent::process();
if ($this[AbstractCommand::DISABLE_VALIDATION]) {
// skipping validation in all cases
return;
}
if (!$this->result instanceof Model) {
// result is not a model - no way to validate
return;
}
$errors = array();
$validator = SchemaValidator::getInstance();
// validate parameters present
$schema = $this->result->getStructure();
$value = $this->result->toArray();
if (!$validator->validate($schema, $value)) {
$errors = $validator->getErrors();
}
// @todo validate additional parameters?
// $schema->getAdditionalProperties() );
if ($errors) {
$e = new ValidationException('Response failed model validation: ' . implode("\n", $errors));
$e->setErrors($errors);
throw $e;
}
}
示例2: process
/**
* {@inheritdoc}
*/
protected function process()
{
parent::process();
// Set the GetObject URL if using the PutObject operation
if ($this->result instanceof Model && $this->getName() == 'PutObject') {
$this->result->set('ObjectURL', $this->getRequest()->getUrl());
}
}
示例3: process
protected function process()
{
parent::process();
$response = $this->request->getResponse();
$links = [];
if ($response->hasHeader('Link')) {
$linkParser = new LinkParser();
$links = $linkParser->parseLinkHeader($response->getHeader('Link'));
}
$this->result = new Collection($this->result, $links, $this->getClient());
}
示例4: process
/**
* {@inheritdoc}
*/
protected function process()
{
$request = $this->getRequest();
$response = $this->getResponse();
// Dispatch an error if a 301 redirect occurred
if ($response->getStatusCode() == 301) {
$this->getClient()->getEventDispatcher()->dispatch('request.error', new Event(array('request' => $this->getRequest(), 'response' => $response)));
}
parent::process();
// Set the GetObject URL if using the PutObject operation
if ($this->result instanceof Model && $this->getName() == 'PutObject') {
$this->result->set('ObjectURL', $request->getUrl());
}
}
示例5: process
/**
* {@inheritdoc}
*/
protected function process()
{
$request = $this->getRequest();
$response = $this->getResponse();
// Dispatch an error if a 301 redirect occurred
if ($response->getStatusCode() == 301) {
$this->getClient()->getEventDispatcher()->dispatch('request.error', new Event(array('request' => $this->getRequest(), 'response' => $response)));
}
parent::process();
// Set the GetObject URL if using the PutObject operation
if ($this->result instanceof Model && $this->getName() == 'PutObject') {
$this->result->set('ObjectURL', $request->getUrl());
}
if ($this->result instanceof Model && $this->getName() == 'GetObject') {
$npos = strpos($response, "\n\r");
$head = substr($response, 0, $npos);
COMMONLOG(DEBUG, "receive head:%s", $head);
} else {
COMMONLOG(DEBUG, "receive msg:%s", $response);
}
COMMONLOG(INFO, "http request:status:%d, code:, message:", $response->getStatusCode());
}
示例6: process
protected function process()
{
parent::process();
}