mirror of
https://github.com/guzzle/guzzle.git
synced 2025-02-25 02:22:57 +01:00
Docblock cleanup to Service
This commit is contained in:
parent
2bc5259df1
commit
fb71aa8da5
@ -10,19 +10,13 @@ use Guzzle\Common\Exception\RuntimeException;
|
||||
*/
|
||||
abstract class AbstractConfigLoader implements ConfigLoaderInterface
|
||||
{
|
||||
/**
|
||||
* @var array Array of aliases for actual filenames
|
||||
*/
|
||||
/** @var array Array of aliases for actual filenames */
|
||||
protected $aliases = array();
|
||||
|
||||
/**
|
||||
* @var array Hash of previously loaded filenames
|
||||
*/
|
||||
/** @var array Hash of previously loaded filenames */
|
||||
protected $loadedFiles = array();
|
||||
|
||||
/**
|
||||
* @var array JSON error code mappings
|
||||
*/
|
||||
/** @var array JSON error code mappings */
|
||||
protected static $jsonErrors = array(
|
||||
JSON_ERROR_NONE => 'JSON_ERROR_NONE - No errors',
|
||||
JSON_ERROR_DEPTH => 'JSON_ERROR_DEPTH - Maximum stack depth exceeded',
|
||||
@ -32,9 +26,6 @@ abstract class AbstractConfigLoader implements ConfigLoaderInterface
|
||||
JSON_ERROR_UTF8 => 'JSON_ERROR_UTF8 - Malformed UTF-8 characters, possibly incorrectly encoded'
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($config, array $options = array())
|
||||
{
|
||||
// Reset the array of loaded files because this is a new config
|
||||
|
@ -13,24 +13,16 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
*/
|
||||
class ServiceBuilder extends AbstractHasDispatcher implements ServiceBuilderInterface, \ArrayAccess, \Serializable
|
||||
{
|
||||
/**
|
||||
* @var array Service builder configuration data
|
||||
*/
|
||||
/** @var array Service builder configuration data */
|
||||
protected $builderConfig = array();
|
||||
|
||||
/**
|
||||
* @var array Instantiated client objects
|
||||
*/
|
||||
/** @var array Instantiated client objects */
|
||||
protected $clients = array();
|
||||
|
||||
/**
|
||||
* @var ServiceBuilderLoader Cached instance of the service builder loader
|
||||
*/
|
||||
/** @var ServiceBuilderLoader Cached instance of the service builder loader */
|
||||
protected static $cachedFactory;
|
||||
|
||||
/**
|
||||
* @var array Plugins to attach to each client created by the service builder
|
||||
*/
|
||||
/** @var array Plugins to attach to each client created by the service builder */
|
||||
protected $plugins = array();
|
||||
|
||||
/**
|
||||
@ -56,8 +48,6 @@ class ServiceBuilder extends AbstractHasDispatcher implements ServiceBuilderInte
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new service builder
|
||||
*
|
||||
* @param array $serviceBuilderConfig Service configuration settings:
|
||||
* - name: Name of the service
|
||||
* - class: Client class to instantiate using a factory method
|
||||
@ -68,29 +58,16 @@ class ServiceBuilder extends AbstractHasDispatcher implements ServiceBuilderInte
|
||||
$this->builderConfig = $serviceBuilderConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getAllEvents()
|
||||
{
|
||||
return array('service_builder.create_client');
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the service builder from JSON
|
||||
*
|
||||
* @param string $serialized JSON data to restore from
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
$this->builderConfig = json_decode($serialized, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the service builder as a string
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return json_encode($this->builderConfig);
|
||||
@ -122,9 +99,6 @@ class ServiceBuilder extends AbstractHasDispatcher implements ServiceBuilderInte
|
||||
return isset($this->builderConfig[$name]) ? $this->builderConfig[$name] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get($name, $throwAway = false)
|
||||
{
|
||||
if (!isset($this->builderConfig[$name])) {
|
||||
@ -171,9 +145,6 @@ class ServiceBuilder extends AbstractHasDispatcher implements ServiceBuilderInte
|
||||
return $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set($key, $service)
|
||||
{
|
||||
$this->builderConfig[$key] = $service;
|
||||
|
@ -10,9 +10,6 @@ use Guzzle\Service\Exception\ServiceNotFoundException;
|
||||
*/
|
||||
class ServiceBuilderLoader extends AbstractConfigLoader
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function build($config, array $options)
|
||||
{
|
||||
// A service builder class can be specified in the class field
|
||||
@ -58,9 +55,6 @@ class ServiceBuilderLoader extends AbstractConfigLoader
|
||||
return new $class($services);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function mergeData(array $a, array $b)
|
||||
{
|
||||
$result = $b + $a;
|
||||
|
@ -9,19 +9,13 @@ use Guzzle\Cache\CacheAdapterInterface;
|
||||
*/
|
||||
class CachingConfigLoader implements ConfigLoaderInterface
|
||||
{
|
||||
/**
|
||||
* @var ConfigLoaderInterface
|
||||
*/
|
||||
/** @var ConfigLoaderInterface */
|
||||
protected $loader;
|
||||
|
||||
/**
|
||||
* @var CacheAdapterInterface
|
||||
*/
|
||||
/** @var CacheAdapterInterface */
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* Add caching to a config loader
|
||||
*
|
||||
* @param ConfigLoaderInterface $loader Loader used to load the config when there is a cache miss
|
||||
* @param CacheAdapterInterface $cache Object used to cache the loaded result
|
||||
*/
|
||||
@ -31,9 +25,6 @@ class CachingConfigLoader implements ConfigLoaderInterface
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load($config, array $options = array())
|
||||
{
|
||||
if (!is_string($config)) {
|
||||
|
@ -38,39 +38,25 @@ abstract class AbstractCommand extends Collection implements CommandInterface
|
||||
// Option used to change the entity body used to store a response
|
||||
const RESPONSE_BODY = 'command.response_body';
|
||||
|
||||
/**
|
||||
* @var ClientInterface Client object used to execute the command
|
||||
*/
|
||||
/** @var ClientInterface Client object used to execute the command */
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* @var RequestInterface The request object associated with the command
|
||||
*/
|
||||
/** @var RequestInterface The request object associated with the command */
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* @var mixed The result of the command
|
||||
*/
|
||||
/** @var mixed The result of the command */
|
||||
protected $result;
|
||||
|
||||
/**
|
||||
* @var OperationInterface API information about the command
|
||||
*/
|
||||
/** @var OperationInterface API information about the command */
|
||||
protected $operation;
|
||||
|
||||
/**
|
||||
* @var mixed callable
|
||||
*/
|
||||
/** @var mixed callable */
|
||||
protected $onComplete;
|
||||
|
||||
/**
|
||||
* @var ValidatorInterface Validator used to prepare and validate properties against a JSON schema
|
||||
*/
|
||||
/** @var ValidatorInterface Validator used to prepare and validate properties against a JSON schema */
|
||||
protected $validator;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array|Collection $parameters Collection of parameters to set on the command
|
||||
* @param OperationInterface $operation Command definition from description
|
||||
*/
|
||||
@ -129,9 +115,6 @@ abstract class AbstractCommand extends Collection implements CommandInterface
|
||||
return $this->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->operation->getName();
|
||||
@ -147,9 +130,6 @@ abstract class AbstractCommand extends Collection implements CommandInterface
|
||||
return $this->operation;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setOnComplete($callable)
|
||||
{
|
||||
if (!is_callable($callable)) {
|
||||
@ -161,9 +141,6 @@ abstract class AbstractCommand extends Collection implements CommandInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
if (!$this->client) {
|
||||
@ -173,17 +150,11 @@ abstract class AbstractCommand extends Collection implements CommandInterface
|
||||
return $this->client->execute($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getClient()
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setClient(ClientInterface $client)
|
||||
{
|
||||
$this->client = $client;
|
||||
@ -191,9 +162,6 @@ abstract class AbstractCommand extends Collection implements CommandInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
if (!$this->request) {
|
||||
@ -203,9 +171,6 @@ abstract class AbstractCommand extends Collection implements CommandInterface
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
if (!$this->isExecuted()) {
|
||||
@ -215,9 +180,6 @@ abstract class AbstractCommand extends Collection implements CommandInterface
|
||||
return $this->request->getResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getResult()
|
||||
{
|
||||
if (!$this->isExecuted()) {
|
||||
@ -235,9 +197,6 @@ abstract class AbstractCommand extends Collection implements CommandInterface
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setResult($result)
|
||||
{
|
||||
$this->result = $result;
|
||||
@ -245,25 +204,16 @@ abstract class AbstractCommand extends Collection implements CommandInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isPrepared()
|
||||
{
|
||||
return $this->request !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isExecuted()
|
||||
{
|
||||
return $this->request !== null && $this->request->getState() == 'complete';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepare()
|
||||
{
|
||||
if (!$this->isPrepared()) {
|
||||
@ -322,9 +272,6 @@ abstract class AbstractCommand extends Collection implements CommandInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRequestHeaders()
|
||||
{
|
||||
return $this->get(self::HEADERS_OPTION);
|
||||
|
@ -15,19 +15,13 @@ use Guzzle\Service\Description\Parameter;
|
||||
*/
|
||||
class DefaultRequestSerializer implements RequestSerializerInterface
|
||||
{
|
||||
/**
|
||||
* @var VisitorFlyweight $factory Visitor factory
|
||||
*/
|
||||
/** @var VisitorFlyweight $factory Visitor factory */
|
||||
protected $factory;
|
||||
|
||||
/**
|
||||
* @var self
|
||||
*/
|
||||
/** @var self */
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
* Get a cached default instance of the class
|
||||
*
|
||||
* @return self
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
@ -63,9 +57,6 @@ class DefaultRequestSerializer implements RequestSerializerInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepare(CommandInterface $command)
|
||||
{
|
||||
$request = $this->createRequest($command);
|
||||
|
@ -9,13 +9,10 @@ use Guzzle\Http\Message\Response;
|
||||
*/
|
||||
class DefaultResponseParser implements ResponseParserInterface
|
||||
{
|
||||
/**
|
||||
* @var self
|
||||
*/
|
||||
/** @var self */
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
* Get a cached instance of the default response parser
|
||||
* @return self
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
@ -28,9 +25,6 @@ class DefaultResponseParser implements ResponseParserInterface
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function parse(CommandInterface $command)
|
||||
{
|
||||
$response = $command->getRequest()->getResponse();
|
||||
@ -45,9 +39,6 @@ class DefaultResponseParser implements ResponseParserInterface
|
||||
return $this->handleParsing($command, $response, $contentType);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function handleParsing(AbstractCommand $command, Response $response, $contentType)
|
||||
{
|
||||
$result = $response;
|
||||
|
@ -10,14 +10,10 @@ use Guzzle\Service\ClientInterface;
|
||||
*/
|
||||
class AliasFactory implements FactoryInterface
|
||||
{
|
||||
/**
|
||||
* @var array Associative array mapping command aliases to the aliased command
|
||||
*/
|
||||
/** @var array Associative array mapping command aliases to the aliased command */
|
||||
protected $aliases;
|
||||
|
||||
/**
|
||||
* @var ClientInterface Client used to retry using aliases
|
||||
*/
|
||||
/** @var ClientInterface Client used to retry using aliases */
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
@ -30,9 +26,6 @@ class AliasFactory implements FactoryInterface
|
||||
$this->aliases = $aliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function factory($name, array $args = array())
|
||||
{
|
||||
if (isset($this->aliases[$name])) {
|
||||
|
@ -10,9 +10,7 @@ use Guzzle\Service\ClientInterface;
|
||||
*/
|
||||
class CompositeFactory implements \IteratorAggregate, \Countable, FactoryInterface
|
||||
{
|
||||
/**
|
||||
* @var array Array of command factories
|
||||
*/
|
||||
/** @var array Array of command factories */
|
||||
protected $factories;
|
||||
|
||||
/**
|
||||
@ -145,17 +143,11 @@ class CompositeFactory implements \IteratorAggregate, \Countable, FactoryInterfa
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->factories);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->factories);
|
||||
|
@ -11,14 +11,10 @@ use Guzzle\Service\ClientInterface;
|
||||
*/
|
||||
class ConcreteClassFactory implements FactoryInterface
|
||||
{
|
||||
/**
|
||||
* @var ClientInterface
|
||||
*/
|
||||
/** @var ClientInterface */
|
||||
protected $client;
|
||||
|
||||
/**
|
||||
* @var InflectorInterface
|
||||
*/
|
||||
/** @var InflectorInterface */
|
||||
protected $inflector;
|
||||
|
||||
/**
|
||||
@ -31,9 +27,6 @@ class ConcreteClassFactory implements FactoryInterface
|
||||
$this->inflector = $inflector ?: Inflector::getDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function factory($name, array $args = array())
|
||||
{
|
||||
// Determine the class to instantiate based on the namespace of the current client and the default directory
|
||||
|
@ -7,22 +7,15 @@ namespace Guzzle\Service\Command\Factory;
|
||||
*/
|
||||
class MapFactory implements FactoryInterface
|
||||
{
|
||||
/**
|
||||
* @var array Associative array mapping command names to classes
|
||||
*/
|
||||
/** @var array Associative array mapping command names to classes */
|
||||
protected $map;
|
||||
|
||||
/**
|
||||
* @param array $map Associative array mapping command names to classes
|
||||
*/
|
||||
/** @param array $map Associative array mapping command names to classes */
|
||||
public function __construct(array $map)
|
||||
{
|
||||
$this->map = $map;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function factory($name, array $args = array())
|
||||
{
|
||||
if (isset($this->map[$name])) {
|
||||
|
@ -10,14 +10,10 @@ use Guzzle\Inflection\InflectorInterface;
|
||||
*/
|
||||
class ServiceDescriptionFactory implements FactoryInterface
|
||||
{
|
||||
/**
|
||||
* @var ServiceDescriptionInterface
|
||||
*/
|
||||
/** @var ServiceDescriptionInterface */
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @var InflectorInterface
|
||||
*/
|
||||
/** @var InflectorInterface */
|
||||
protected $inflector;
|
||||
|
||||
/**
|
||||
@ -54,9 +50,6 @@ class ServiceDescriptionFactory implements FactoryInterface
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function factory($name, array $args = array())
|
||||
{
|
||||
$command = $this->description->getOperation($name);
|
||||
|
@ -6,19 +6,14 @@ use Guzzle\Service\Command\CommandInterface;
|
||||
use Guzzle\Http\Message\RequestInterface;
|
||||
use Guzzle\Service\Description\Parameter;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
abstract class AbstractRequestVisitor implements RequestVisitorInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function after(CommandInterface $command, RequestInterface $request) {}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value) {}
|
||||
|
@ -18,9 +18,6 @@ use Guzzle\Service\Description\Parameter;
|
||||
*/
|
||||
class BodyVisitor extends AbstractRequestVisitor
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
|
||||
{
|
||||
$value = $param->filter($value);
|
||||
|
@ -12,9 +12,6 @@ use Guzzle\Service\Description\Parameter;
|
||||
*/
|
||||
class HeaderVisitor extends AbstractRequestVisitor
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
|
||||
{
|
||||
$value = $param->filter($value);
|
||||
|
@ -11,19 +11,12 @@ use Guzzle\Service\Description\Parameter;
|
||||
*/
|
||||
class JsonVisitor extends AbstractRequestVisitor
|
||||
{
|
||||
/**
|
||||
* @var bool Whether or not to add a Content-Type header when JSON is found
|
||||
*/
|
||||
/** @var bool Whether or not to add a Content-Type header when JSON is found */
|
||||
protected $jsonContentType = 'application/json';
|
||||
|
||||
/**
|
||||
* @var \SplObjectStorage Data object for persisting JSON data
|
||||
*/
|
||||
/** @var \SplObjectStorage Data object for persisting JSON data */
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* This visitor uses an {@see \SplObjectStorage} to associate JSON data with commands
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->data = new \SplObjectStorage();
|
||||
@ -44,9 +37,6 @@ class JsonVisitor extends AbstractRequestVisitor
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
|
||||
{
|
||||
if (isset($this->data[$command])) {
|
||||
@ -58,9 +48,6 @@ class JsonVisitor extends AbstractRequestVisitor
|
||||
$this->data[$command] = $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function after(CommandInterface $command, RequestInterface $request)
|
||||
{
|
||||
if (isset($this->data[$command])) {
|
||||
|
@ -11,9 +11,6 @@ use Guzzle\Service\Description\Parameter;
|
||||
*/
|
||||
class PostFieldVisitor extends AbstractRequestVisitor
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
|
||||
{
|
||||
$request->setPostField($param->getWireName(), $this->prepareValue($value, $param));
|
||||
|
@ -12,9 +12,6 @@ use Guzzle\Service\Description\Parameter;
|
||||
*/
|
||||
class PostFileVisitor extends AbstractRequestVisitor
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
|
||||
{
|
||||
$value = $param->filter($value);
|
||||
|
@ -11,9 +11,6 @@ use Guzzle\Service\Description\Parameter;
|
||||
*/
|
||||
class QueryVisitor extends AbstractRequestVisitor
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
|
||||
{
|
||||
$request->getQuery()->set($param->getWireName(), $this->prepareValue($value, $param));
|
||||
|
@ -11,9 +11,6 @@ use Guzzle\Service\Description\Parameter;
|
||||
*/
|
||||
class ResponseBodyVisitor extends AbstractRequestVisitor
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
|
||||
{
|
||||
$request->setResponseBody($value);
|
||||
|
@ -12,19 +12,12 @@ use Guzzle\Service\Description\Parameter;
|
||||
*/
|
||||
class XmlVisitor extends AbstractRequestVisitor
|
||||
{
|
||||
/**
|
||||
* @var \SplObjectStorage Data object for persisting XML data
|
||||
*/
|
||||
/** @var \SplObjectStorage Data object for persisting XML data */
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* @var bool Content-Type header added when XML is found
|
||||
*/
|
||||
/** @var bool Content-Type header added when XML is found */
|
||||
protected $contentType = 'application/xml';
|
||||
|
||||
/**
|
||||
* This visitor uses an {@see \SplObjectStorage} to associate XML data with commands
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->data = new \SplObjectStorage();
|
||||
@ -44,9 +37,6 @@ class XmlVisitor extends AbstractRequestVisitor
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
|
||||
{
|
||||
$xml = isset($this->data[$command])
|
||||
@ -56,9 +46,6 @@ class XmlVisitor extends AbstractRequestVisitor
|
||||
$this->data[$command] = $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function after(CommandInterface $command, RequestInterface $request)
|
||||
{
|
||||
$xml = null;
|
||||
|
@ -8,24 +8,13 @@ use Guzzle\Service\Description\Parameter;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
abstract class AbstractResponseVisitor implements ResponseVisitorInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function before(CommandInterface $command, array &$result) {}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function after(CommandInterface $command) {}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function visit(CommandInterface $command, Response $response, Parameter $param, &$value, $context = null) {}
|
||||
}
|
||||
|
@ -11,9 +11,6 @@ use Guzzle\Service\Description\Parameter;
|
||||
*/
|
||||
class BodyVisitor extends AbstractResponseVisitor
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, Response $response, Parameter $param, &$value, $context = null)
|
||||
{
|
||||
$value[$param->getName()] = $param->filter($response->getBody());
|
||||
|
@ -11,9 +11,6 @@ use Guzzle\Service\Command\CommandInterface;
|
||||
*/
|
||||
class HeaderVisitor extends AbstractResponseVisitor
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, Response $response, Parameter $param, &$value, $context = null)
|
||||
{
|
||||
if ($param->getType() == 'object' && $param->getAdditionalProperties() instanceof Parameter) {
|
||||
|
@ -16,18 +16,12 @@ use Guzzle\Service\Command\CommandInterface;
|
||||
*/
|
||||
class JsonVisitor extends AbstractResponseVisitor
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function before(CommandInterface $command, array &$result)
|
||||
{
|
||||
// Ensure that the result of the command is always rooted with the parsed JSON data
|
||||
$result = $command->getResponse()->json();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, Response $response, Parameter $param, &$value, $context = null)
|
||||
{
|
||||
$name = $param->getName();
|
||||
|
@ -11,9 +11,6 @@ use Guzzle\Service\Command\CommandInterface;
|
||||
*/
|
||||
class ReasonPhraseVisitor extends AbstractResponseVisitor
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, Response $response, Parameter $param, &$value, $context = null)
|
||||
{
|
||||
$value[$param->getName()] = $response->getReasonPhrase();
|
||||
|
@ -11,9 +11,6 @@ use Guzzle\Service\Command\CommandInterface;
|
||||
*/
|
||||
class StatusCodeVisitor extends AbstractResponseVisitor
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, Response $response, Parameter $param, &$value, $context = null)
|
||||
{
|
||||
$value[$param->getName()] = $response->getStatusCode();
|
||||
|
@ -11,18 +11,12 @@ use Guzzle\Service\Command\CommandInterface;
|
||||
*/
|
||||
class XmlVisitor extends AbstractResponseVisitor
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function before(CommandInterface $command, array &$result)
|
||||
{
|
||||
// Set the result of the command to the array conversion of the XML body
|
||||
$result = json_decode(json_encode($command->getResponse()->xml()), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function visit(CommandInterface $command, Response $response, Parameter $param, &$value, $context = null)
|
||||
{
|
||||
$sentAs = $param->getWireName();
|
||||
|
@ -11,14 +11,10 @@ use Guzzle\Service\Command\LocationVisitor\Response\ResponseVisitorInterface;
|
||||
*/
|
||||
class VisitorFlyweight
|
||||
{
|
||||
/**
|
||||
* @var self Singleton instance of self
|
||||
*/
|
||||
/** @var self Singleton instance of self */
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
* @var array Default array of mappings of location names to classes
|
||||
*/
|
||||
/** @var array Default array of mappings of location names to classes */
|
||||
protected static $defaultMappings = array(
|
||||
'request.body' => 'Guzzle\Service\Command\LocationVisitor\Request\BodyVisitor',
|
||||
'request.header' => 'Guzzle\Service\Command\LocationVisitor\Request\HeaderVisitor',
|
||||
@ -37,19 +33,13 @@ class VisitorFlyweight
|
||||
'response.xml' => 'Guzzle\Service\Command\LocationVisitor\Response\XmlVisitor'
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array Array of mappings of location names to classes
|
||||
*/
|
||||
/** @var array Array of mappings of location names to classes */
|
||||
protected $mappings;
|
||||
|
||||
/**
|
||||
* @var array Cache of instantiated visitors
|
||||
*/
|
||||
/** @var array Cache of instantiated visitors */
|
||||
protected $cache = array();
|
||||
|
||||
/**
|
||||
* Get a cached instance of the flyweight factory
|
||||
*
|
||||
* @return self
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
@ -63,8 +53,6 @@ class VisitorFlyweight
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new flyweight
|
||||
*
|
||||
* @param array $mappings Array mapping request.name and response.name to location visitor classes. Leave null to
|
||||
* use the default values.
|
||||
*/
|
||||
|
@ -9,14 +9,10 @@ namespace Guzzle\Service\Command;
|
||||
*/
|
||||
class OperationCommand extends AbstractCommand
|
||||
{
|
||||
/**
|
||||
* @var RequestSerializerInterface
|
||||
*/
|
||||
/** @var RequestSerializerInterface */
|
||||
protected $requestSerializer;
|
||||
|
||||
/**
|
||||
* @var ResponseParserInterface Response parser
|
||||
*/
|
||||
/** @var ResponseParserInterface Response parser */
|
||||
protected $responseParser;
|
||||
|
||||
/**
|
||||
@ -77,18 +73,12 @@ class OperationCommand extends AbstractCommand
|
||||
return $this->responseParser;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function build()
|
||||
{
|
||||
// Prepare and serialize the request
|
||||
$this->request = $this->getRequestSerializer()->prepare($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function process()
|
||||
{
|
||||
// Do not process the response if 'command.response_processing' is set to 'raw'
|
||||
|
@ -16,19 +16,13 @@ use Guzzle\Service\Resource\Model;
|
||||
*/
|
||||
class OperationResponseParser extends DefaultResponseParser
|
||||
{
|
||||
/**
|
||||
* @var VisitorFlyweight $factory Visitor factory
|
||||
*/
|
||||
/** @var VisitorFlyweight $factory Visitor factory */
|
||||
protected $factory;
|
||||
|
||||
/**
|
||||
* @var self
|
||||
*/
|
||||
/** @var self */
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
* Get a cached default instance of the Operation response parser that uses default visitors
|
||||
*
|
||||
* @return self
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
@ -64,9 +58,6 @@ class OperationResponseParser extends DefaultResponseParser
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function handleParsing(AbstractCommand $command, Response $response, $contentType)
|
||||
{
|
||||
$operation = $command->getOperation();
|
||||
|
@ -9,14 +9,10 @@ use Guzzle\Common\Exception\InvalidArgumentException;
|
||||
*/
|
||||
class Operation implements OperationInterface
|
||||
{
|
||||
/**
|
||||
* @var string Default command class to use when none is specified
|
||||
*/
|
||||
/** @var string Default command class to use when none is specified */
|
||||
const DEFAULT_COMMAND_CLASS = 'Guzzle\\Service\\Command\\OperationCommand';
|
||||
|
||||
/**
|
||||
* @var array Hashmap of properties that can be specified. Represented as a hash to speed up constructor.
|
||||
*/
|
||||
/** @var array Hashmap of properties that can be specified. Represented as a hash to speed up constructor. */
|
||||
protected static $properties = array(
|
||||
'name' => true, 'httpMethod' => true, 'uri' => true, 'class' => true, 'responseClass' => true,
|
||||
'responseType' => true, 'responseNotes' => true, 'notes' => true, 'summary' => true, 'documentationUrl' => true,
|
||||
@ -24,84 +20,52 @@ class Operation implements OperationInterface
|
||||
'errorResponses' => true
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array Parameters
|
||||
*/
|
||||
/** @var array Parameters */
|
||||
protected $parameters = array();
|
||||
|
||||
/**
|
||||
* @var Parameter Additional parameters schema
|
||||
*/
|
||||
/** @var Parameter Additional parameters schema */
|
||||
protected $additionalParameters;
|
||||
|
||||
/**
|
||||
* @var string Name of the command
|
||||
*/
|
||||
/** @var string Name of the command */
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* @var string HTTP method
|
||||
*/
|
||||
/** @var string HTTP method */
|
||||
protected $httpMethod;
|
||||
|
||||
/**
|
||||
* @var string This is a short summary of what the operation does
|
||||
*/
|
||||
/** @var string This is a short summary of what the operation does */
|
||||
protected $summary;
|
||||
|
||||
/**
|
||||
* @var string A longer text field to explain the behavior of the operation.
|
||||
*/
|
||||
/** @var string A longer text field to explain the behavior of the operation. */
|
||||
protected $notes;
|
||||
|
||||
/**
|
||||
* @var string Reference URL providing more information about the operation
|
||||
*/
|
||||
/** @var string Reference URL providing more information about the operation */
|
||||
protected $documentationUrl;
|
||||
|
||||
/**
|
||||
* @var string HTTP URI of the command
|
||||
*/
|
||||
/** @var string HTTP URI of the command */
|
||||
protected $uri;
|
||||
|
||||
/**
|
||||
* @var string Class of the command object
|
||||
*/
|
||||
/** @var string Class of the command object */
|
||||
protected $class;
|
||||
|
||||
/**
|
||||
* @var string This is what is returned from the method
|
||||
*/
|
||||
/** @var string This is what is returned from the method */
|
||||
protected $responseClass;
|
||||
|
||||
/**
|
||||
* @var string Type information about the response
|
||||
*/
|
||||
/** @var string Type information about the response */
|
||||
protected $responseType;
|
||||
|
||||
/**
|
||||
* @var string Information about the response returned by the operation
|
||||
*/
|
||||
/** @var string Information about the response returned by the operation */
|
||||
protected $responseNotes;
|
||||
|
||||
/**
|
||||
* @var bool Whether or not the command is deprecated
|
||||
*/
|
||||
/** @var bool Whether or not the command is deprecated */
|
||||
protected $deprecated;
|
||||
|
||||
/**
|
||||
* @var array Array of errors that could occur when running the command
|
||||
*/
|
||||
/** @var array Array of errors that could occur when running the command */
|
||||
protected $errorResponses;
|
||||
|
||||
/**
|
||||
* @var ServiceDescriptionInterface
|
||||
*/
|
||||
/** @var ServiceDescriptionInterface */
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @var array Extra operation information
|
||||
*/
|
||||
/** @var array Extra operation information */
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
@ -180,9 +144,6 @@ class Operation implements OperationInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
$result = array();
|
||||
@ -207,17 +168,11 @@ class Operation implements OperationInterface
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getServiceDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setServiceDescription(ServiceDescriptionInterface $description)
|
||||
{
|
||||
$this->description = $description;
|
||||
@ -225,33 +180,21 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParams()
|
||||
{
|
||||
return $this->parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParamNames()
|
||||
{
|
||||
return array_keys($this->parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasParam($name)
|
||||
{
|
||||
return isset($this->parameters[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParam($param)
|
||||
{
|
||||
return isset($this->parameters[$param]) ? $this->parameters[$param] : null;
|
||||
@ -286,9 +229,6 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return $this->httpMethod;
|
||||
@ -308,9 +248,6 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getClass()
|
||||
{
|
||||
return $this->class;
|
||||
@ -330,9 +267,6 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
@ -352,9 +286,6 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSummary()
|
||||
{
|
||||
return $this->summary;
|
||||
@ -374,9 +305,6 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getNotes()
|
||||
{
|
||||
return $this->notes;
|
||||
@ -396,9 +324,6 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDocumentationUrl()
|
||||
{
|
||||
return $this->documentationUrl;
|
||||
@ -418,9 +343,6 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getResponseClass()
|
||||
{
|
||||
return $this->responseClass;
|
||||
@ -442,9 +364,6 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getResponseType()
|
||||
{
|
||||
return $this->responseType;
|
||||
@ -475,9 +394,6 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getResponseNotes()
|
||||
{
|
||||
return $this->responseNotes;
|
||||
@ -497,9 +413,6 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDeprecated()
|
||||
{
|
||||
return $this->deprecated;
|
||||
@ -519,9 +432,6 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getUri()
|
||||
{
|
||||
return $this->uri;
|
||||
@ -541,9 +451,6 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getErrorResponses()
|
||||
{
|
||||
return $this->errorResponses;
|
||||
@ -579,9 +486,6 @@ class Operation implements OperationInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getData($name)
|
||||
{
|
||||
return isset($this->data[$name]) ? $this->data[$name] : null;
|
||||
|
@ -9,9 +9,7 @@ use Guzzle\Common\Exception\InvalidArgumentException;
|
||||
*/
|
||||
class SchemaFormatter
|
||||
{
|
||||
/**
|
||||
* @var \DateTimeZone
|
||||
*/
|
||||
/** @var \DateTimeZone */
|
||||
protected static $utcTimeZone;
|
||||
|
||||
/**
|
||||
|
@ -9,24 +9,16 @@ use Guzzle\Common\ToArrayInterface;
|
||||
*/
|
||||
class SchemaValidator implements ValidatorInterface
|
||||
{
|
||||
/**
|
||||
* @var self Cache instance of the object
|
||||
*/
|
||||
/** @var self Cache instance of the object */
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
* @var bool Whether or not integers are converted to strings when an integer is received for a string input
|
||||
*/
|
||||
/** @var bool Whether or not integers are converted to strings when an integer is received for a string input */
|
||||
protected $castIntegerToStringType;
|
||||
|
||||
/**
|
||||
* @var array Errors encountered while validating
|
||||
*/
|
||||
/** @var array Errors encountered while validating */
|
||||
protected $errors;
|
||||
|
||||
/**
|
||||
* Get a cached instance
|
||||
*
|
||||
* @return self
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
@ -48,9 +40,6 @@ class SchemaValidator implements ValidatorInterface
|
||||
$this->castIntegerToStringType = $castIntegerToStringType;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(Parameter $param, &$value)
|
||||
{
|
||||
$this->errors = array();
|
||||
|
@ -10,44 +10,28 @@ use Guzzle\Common\ToArrayInterface;
|
||||
*/
|
||||
class ServiceDescription implements ServiceDescriptionInterface, ToArrayInterface
|
||||
{
|
||||
/**
|
||||
* @var array Array of {@see OperationInterface} objects
|
||||
*/
|
||||
/** @var array Array of {@see OperationInterface} objects */
|
||||
protected $operations = array();
|
||||
|
||||
/**
|
||||
* @var array Array of API models
|
||||
*/
|
||||
/** @var array Array of API models */
|
||||
protected $models = array();
|
||||
|
||||
/**
|
||||
* @var string Name of the API
|
||||
*/
|
||||
/** @var string Name of the API */
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* @var string API version
|
||||
*/
|
||||
/** @var string API version */
|
||||
protected $apiVersion;
|
||||
|
||||
/**
|
||||
* @var string Summary of the API
|
||||
*/
|
||||
/** @var string Summary of the API */
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @var array Any extra API data
|
||||
*/
|
||||
/** @var array Any extra API data */
|
||||
protected $extraData = array();
|
||||
|
||||
/**
|
||||
* @var ServiceDescriptionLoader Factory used in factory method
|
||||
*/
|
||||
/** @var ServiceDescriptionLoader Factory used in factory method */
|
||||
protected static $descriptionLoader;
|
||||
|
||||
/**
|
||||
* @var string baseUrl/basePath
|
||||
*/
|
||||
/** @var string baseUrl/basePath */
|
||||
protected $baseUrl;
|
||||
|
||||
/**
|
||||
@ -69,8 +53,6 @@ class ServiceDescription implements ServiceDescriptionInterface, ToArrayInterfac
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new ServiceDescription
|
||||
*
|
||||
* @param array $config Array of configuration data
|
||||
*/
|
||||
public function __construct(array $config = array())
|
||||
@ -78,19 +60,17 @@ class ServiceDescription implements ServiceDescriptionInterface, ToArrayInterfac
|
||||
$this->fromArray($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize the service description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return json_encode($this->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function unserialize($json)
|
||||
{
|
||||
$this->operations = array();
|
||||
$this->fromArray(json_decode($json, true));
|
||||
}
|
||||
|
||||
public function toArray()
|
||||
{
|
||||
$result = array(
|
||||
@ -113,20 +93,6 @@ class ServiceDescription implements ServiceDescriptionInterface, ToArrayInterfac
|
||||
return array_filter($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserialize the service description
|
||||
*
|
||||
* @param string|array $json JSON data
|
||||
*/
|
||||
public function unserialize($json)
|
||||
{
|
||||
$this->operations = array();
|
||||
$this->fromArray(json_decode($json, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getBaseUrl()
|
||||
{
|
||||
return $this->baseUrl;
|
||||
@ -146,9 +112,6 @@ class ServiceDescription implements ServiceDescriptionInterface, ToArrayInterfac
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOperations()
|
||||
{
|
||||
foreach (array_keys($this->operations) as $name) {
|
||||
@ -158,17 +121,11 @@ class ServiceDescription implements ServiceDescriptionInterface, ToArrayInterfac
|
||||
return $this->operations;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasOperation($name)
|
||||
{
|
||||
return isset($this->operations[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getOperation($name)
|
||||
{
|
||||
// Lazily retrieve and build operations
|
||||
@ -197,9 +154,6 @@ class ServiceDescription implements ServiceDescriptionInterface, ToArrayInterfac
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getModel($id)
|
||||
{
|
||||
if (!isset($this->models[$id])) {
|
||||
@ -213,9 +167,6 @@ class ServiceDescription implements ServiceDescriptionInterface, ToArrayInterfac
|
||||
return $this->models[$id];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getModels()
|
||||
{
|
||||
// Ensure all models are converted into parameter objects
|
||||
@ -226,9 +177,6 @@ class ServiceDescription implements ServiceDescriptionInterface, ToArrayInterfac
|
||||
return $this->models;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasModel($id)
|
||||
{
|
||||
return isset($this->models[$id]);
|
||||
@ -248,41 +196,26 @@ class ServiceDescription implements ServiceDescriptionInterface, ToArrayInterfac
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getApiVersion()
|
||||
{
|
||||
return $this->apiVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getData($key)
|
||||
{
|
||||
return isset($this->extraData[$key]) ? $this->extraData[$key] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setData($key, $value)
|
||||
{
|
||||
$this->extraData[$key] = $value;
|
||||
|
@ -10,9 +10,6 @@ use Guzzle\Service\Exception\DescriptionBuilderException;
|
||||
*/
|
||||
class ServiceDescriptionLoader extends AbstractConfigLoader
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function build($config, array $options)
|
||||
{
|
||||
$operations = array();
|
||||
|
Loading…
x
Reference in New Issue
Block a user