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