本文整理汇总了PHP中Guzzle\Service\Description\ServiceDescription::getOperation方法的典型用法代码示例。如果您正苦于以下问题:PHP ServiceDescription::getOperation方法的具体用法?PHP ServiceDescription::getOperation怎么用?PHP ServiceDescription::getOperation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Service\Description\ServiceDescription
的用法示例。
在下文中一共展示了ServiceDescription::getOperation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: factory
/**
* {@inheritdoc}
*/
public function factory($name, array $args = array())
{
$command = $this->description->getOperation($name);
// If an inflector was passed, then attempt to get the command using snake_case inflection
if (!$command && $this->inflector) {
$command = $this->description->getOperation($this->inflector->snake($name));
}
if ($command) {
$class = $command->getClass();
return new $class($args, $command, $this->description);
}
}
示例2: testAllowsRawResponses
public function testAllowsRawResponses()
{
$description = new ServiceDescription(array('operations' => array('foo' => array('responseClass' => 'bar', 'responseType' => 'model')), 'models' => array('bar' => array())));
$op = new OperationCommand(array(OperationCommand::RESPONSE_PROCESSING => OperationCommand::TYPE_RAW), $description->getOperation('foo'));
$op->setClient(new Client());
$request = $op->prepare();
$response = new Response(200, array('Content-Type' => 'application/xml'), '<Foo><Baz>Bar</Baz></Foo>');
$request->setResponse($response, true);
$this->assertSame($response, $op->execute());
}
示例3: registerCommandClass
/**
* Apply a bespoke operation command class to a given method, or all methods
* @param string name of command using this class, or "" for all.
* @param string full class name for operation class field
* @return Swizzle
* @throws \Exception
*/
public function registerCommandClass($name, $class)
{
$this->commandClasses[$name] = $class;
// set retrospectively if method already encountered
if ($this->service) {
if ($name) {
$op = $this->service->getOperation($name) and $op->setClass($class);
} else {
throw new \Exception('Too late to register a global command class');
}
}
return $this;
}
示例4: testReturnsNullWhenRetrievingMissingOperation
public function testReturnsNullWhenRetrievingMissingOperation()
{
$s = new ServiceDescription(array());
$this->assertNull($s->getOperation('foo'));
}