Class Operation
Data object holding the information of an API command
- Guzzle\Service\Description\Operation implements Guzzle\Service\Description\OperationInterface
Methods summary
-
public
__construct ( array $config = array(), Guzzle\Service\Description\ServiceDescriptionInterface $description = null )
Builds an Operation object using an array of configuration data:
- name: (string) Name of the command
- httpMethod: (string) HTTP method of the operation
- uri: (string) URI template that can create a relative or absolute URL
- class: (string) Concrete class that implements this command
- parameters: (array) Associative array of parameters for the command.
Guzzle\Service\Description\Parameter
for information. - summary: (string) This is a short summary of what the operation does
- notes: (string) A longer text field to explain the behavior of the operation.
- documentationUrl: (string) Reference URL providing more information about the operation
- responseClass: (string) This is what is returned from the method. Can be a
primitive, PSR-0 compliant
class name, or model.
- responseNotes: (string) Information about the response returned by the operation
- responseType: (string) One of 'primitive', 'class', 'model', or
'documentation'. If not specified, this
value will be automatically inferred based on whether or not there is a model matching the
name, if a matching PSR-0 compliant class name is found, or set to 'primitive' by default.
- deprecated: (bool) Set to true if this is a deprecated command
- errorResponses: (array) Errors that could occur when executing the command.
Array of hashes, each with a
'code' (the HTTP response code), 'reason' (response reason phrase or description of the
error), and 'class' (a custom exception class that would be thrown if the error is
encountered).
- data: (array) Any extra data that might be used to help build or serialize the operation
- additionalParameters: (null|array) Parameter schema to use when an option is
passed to the operation that is
not in the schema
-
public
toArray ( )
Get the array representation of an object
-
public
getServiceDescription ( )
Get the service description that the operation belongs to
-
public
setServiceDescription ( Guzzle\Service\Description\ServiceDescriptionInterface $description )
Set the service description that the operation belongs to
-
public
getParams ( )
Get the params of the operation
-
public
getParamNames ( )
Returns an array of parameter names
-
public
hasParam ( string $name )
Check if the operation has a specific parameter by name
-
public
getParam ( string $param )
Get a single parameter of the operation
-
public
addParam ( Guzzle\Service\Description\Parameter $param )
Add a parameter to the command
-
public
removeParam ( string $name )
Remove a parameter from the command
-
public
getHttpMethod ( )
Get the HTTP method of the operation
-
public
setHttpMethod ( string $httpMethod )
Set the HTTP method of the command
-
public
getClass ( )
Get the concrete operation class that implements this operation
-
public
setClass ( string $className )
Set the concrete class of the command
-
public
getName ( )
Get the name of the operation
-
public
setName ( string $name )
Set the name of the command
-
public
getSummary ( )
Get a short summary of what the operation does
-
public
setSummary ( string $summary )
Set a short summary of what the operation does
-
public
getNotes ( )
Get a longer text field to explain the behavior of the operation
-
public
setNotes ( string $notes )
Set a longer text field to explain the behavior of the operation.
-
public
getDocumentationUrl ( )
Get the documentation URL of the operation
-
public
setDocumentationUrl ( string $docUrl )
Set the URL pointing to additional documentation on the command
-
public
getResponseClass ( )
Get what is returned from the method. Can be a primitive, class name, or model. For example, the responseClass could be 'array', which would inherently use a responseType of 'primitive'. Using a class name would set a responseType of 'class'. Specifying a model by ID will use a responseType of 'model'.
-
public
setResponseClass ( string $responseClass )
Set what is returned from the method. Can be a primitive, class name, or model. For example: 'array', 'Guzzle\\Foo\\Baz', or 'MyModelName' (to reference a model by ID).
-
public
getResponseType ( )
Get information about how the response is unmarshalled: One of 'primitive', 'class', 'model', or 'documentation'
-
public
setResponseType ( string $responseType )
Set qualifying information about the responseClass. One of 'primitive', 'class', 'model', or 'documentation'
-
public
getResponseNotes ( )
Get notes about the response of the operation
-
public
setResponseNotes ( string $notes )
Set notes about the response of the operation
-
public
getDeprecated ( )
Get whether or not the operation is deprecated
-
public
setDeprecated ( bool $isDeprecated )
Set whether or not the command is deprecated
-
public
getUri ( )
Get the URI that will be merged into the generated request
-
public
setUri ( string $uri )
Set the URI template of the command
-
public
getErrorResponses ( )
Get the errors that could be encountered when executing the operation
-
public
addErrorResponse ( string $code, string $reason, string $class )
Add an error to the command
-
public
setErrorResponses ( array $errorResponses )
Set all of the error responses of the operation
-
public
getData ( string $name )
Get extra data from the operation
-
public
setData ( string $name, mixed $value )
Set a particular data point on the operation
-
public
getAdditionalParameters ( )
Get the additionalParameters of the operation
-
public
setAdditionalParameters ( Parameter|null $parameter )
Set the additionalParameters of the operation
-
protected
inferResponseType ( )
Infer the response type from the responseClass value
Methods detail
public
__construct( array $config = array(), Guzzle\Service\Description\ServiceDescriptionInterface
$description = null )
Builds an Operation object using an array of configuration data:
- name: (string) Name of the command
- httpMethod: (string) HTTP method of the operation
- uri: (string) URI template that can create a relative or absolute URL
- class: (string) Concrete class that implements this command
- parameters: (array) Associative array of parameters for the command.
Guzzle\Service\Description\Parameter
for information. - summary: (string) This is a short summary of what the operation does
- notes: (string) A longer text field to explain the behavior of the operation.
- documentationUrl: (string) Reference URL providing more information about the operation
- responseClass: (string) This is what is returned from the method. Can be a primitive, PSR-0 compliant class name, or model.
- responseNotes: (string) Information about the response returned by the operation
- responseType: (string) One of 'primitive', 'class', 'model', or 'documentation'. If not specified, this value will be automatically inferred based on whether or not there is a model matching the name, if a matching PSR-0 compliant class name is found, or set to 'primitive' by default.
- deprecated: (bool) Set to true if this is a deprecated command
- errorResponses: (array) Errors that could occur when executing the command. Array of hashes, each with a 'code' (the HTTP response code), 'reason' (response reason phrase or description of the error), and 'class' (a custom exception class that would be thrown if the error is encountered).
- data: (array) Any extra data that might be used to help build or serialize the operation
- additionalParameters: (null|array) Parameter schema to use when an option is passed to the operation that is not in the schema
Parameters
- $config
array
$config Array of configuration data- $description
Guzzle\Service\Description\ServiceDescriptionInterface
$description Service description used to resolve models if $ref tags are found
Get the array representation of an object
Returns
array
Implementation of
Get the service description that the operation belongs to
Returns
Implementation of
public
Guzzle\Service\Description\Operation
setServiceDescription( Guzzle\Service\Description\ServiceDescriptionInterface
$description )
Set the service description that the operation belongs to
Parameters
- $description
Guzzle\Service\Description\ServiceDescriptionInterface
$description Service description
Returns
Implementation of
Get the params of the operation
Returns
array
Implementation of
Returns an array of parameter names
Returns
array
Implementation of
Check if the operation has a specific parameter by name
Parameters
- $name
string
$name Name of the param
Returns
boolean
Implementation of
Get a single parameter of the operation
Parameters
- $param
string
$param Parameter to retrieve by name
Returns
Implementation of
public
Guzzle\Service\Description\Operation
addParam( Guzzle\Service\Description\Parameter
$param )
Add a parameter to the command
Parameters
- $param
Guzzle\Service\Description\Parameter
$param Parameter to add
Returns
Remove a parameter from the command
Parameters
- $name
string
$name Name of the parameter to remove
Returns
Get the HTTP method of the operation
Returns
string|null
Implementation of
Set the HTTP method of the command
Parameters
- $httpMethod
string
$httpMethod Method to set
Returns
Get the concrete operation class that implements this operation
Returns
string
Implementation of
Set the concrete class of the command
Parameters
- $className
string
$className Concrete class name
Returns
Get the name of the operation
Returns
string|null
Implementation of
Set the name of the command
Parameters
- $name
string
$name Name of the command
Returns
Get a short summary of what the operation does
Returns
string|null
Implementation of
Set a short summary of what the operation does
Parameters
- $summary
string
$summary Short summary of the operation
Returns
Get a longer text field to explain the behavior of the operation
Returns
string|null
Implementation of
Set a longer text field to explain the behavior of the operation.
Parameters
- $notes
string
$notes Notes on the operation
Returns
Get the documentation URL of the operation
Returns
string|null
Implementation of
Set the URL pointing to additional documentation on the command
Parameters
- $docUrl
string
$docUrl Documentation URL
Returns
Get what is returned from the method. Can be a primitive, class name, or model. For example, the responseClass could be 'array', which would inherently use a responseType of 'primitive'. Using a class name would set a responseType of 'class'. Specifying a model by ID will use a responseType of 'model'.
Returns
string|null
Implementation of
Set what is returned from the method. Can be a primitive, class name, or model. For example: 'array', 'Guzzle\\Foo\\Baz', or 'MyModelName' (to reference a model by ID).
Parameters
- $responseClass
string
$responseClass Type of response
Returns
Get information about how the response is unmarshalled: One of 'primitive', 'class', 'model', or 'documentation'
Returns
string
Implementation of
Set qualifying information about the responseClass. One of 'primitive', 'class', 'model', or 'documentation'
Parameters
- $responseType
string
$responseType Response type information
Returns
Throws
Get notes about the response of the operation
Returns
string|null
Implementation of
Set notes about the response of the operation
Parameters
- $notes
string
$notes Response notes
Returns
Get whether or not the operation is deprecated
Returns
boolean
Implementation of
Set whether or not the command is deprecated
Parameters
- $isDeprecated
boolean
$isDeprecated Set to true to mark as deprecated
Returns
Get the URI that will be merged into the generated request
Returns
string
Implementation of
Set the URI template of the command
Parameters
- $uri
string
$uri URI template to set
Returns
Get the errors that could be encountered when executing the operation
Returns
array
Implementation of
public
Guzzle\Service\Description\Operation
addErrorResponse( string $code, string $reason, string $class )
Add an error to the command
Parameters
- $code
string
$code HTTP response code- $reason
string
$reason HTTP response reason phrase or information about the error- $class
string
$class Exception class associated with the error
Returns
Set all of the error responses of the operation
Parameters
- $errorResponses
array
$errorResponses Hash of error name to a hash containing a code, reason, class
Returns
Get extra data from the operation
Parameters
- $name
string
$name Name of the data point to retrieve
Returns
mixed|null
Implementation of
Set a particular data point on the operation
Parameters
- $name
string
$name Name of the data value- $value
mixed
$value Value to set
Returns
public
Guzzle\Service\Description\Operation
setAdditionalParameters( Guzzle\Service\Description\Parameter
|null $parameter )
Set the additionalParameters of the operation
Parameters
- $parameter
Guzzle\Service\Description\Parameter
|null
$parameter Parameter to set
Returns
Infer the response type from the responseClass value
Magic methods summary
Constants summary
string |
DEFAULT_COMMAND_CLASS |
'Guzzle\\Service\\Command\\OperationCommand' |
#
Default command class to use when none is specified |
Constants inherited from Guzzle\Service\Description\OperationInterface
TYPE_CLASS
,
TYPE_DOCUMENTATION
,
TYPE_MODEL
,
TYPE_PRIMITIVE
Properties summary
protected static
array
|
$properties |
#
Hashmap of properties that can be specified. Represented as a hash to speed up constructor. |
protected
array
|
$parameters |
#
Parameters |
protected
|
$additionalParameters |
#
Additional parameters schema |
protected
string
|
$name |
#
Name of the command |
protected
string
|
$httpMethod |
#
HTTP method |
protected
string
|
$summary |
#
This is a short summary of what the operation does |
protected
string
|
$notes |
#
A longer text field to explain the behavior of the operation. |
protected
string
|
$documentationUrl |
#
Reference URL providing more information about the operation |
protected
string
|
$uri |
#
HTTP URI of the command |
protected
string
|
$class |
#
Class of the command object |
protected
string
|
$responseClass |
#
This is what is returned from the method |
protected
string
|
$responseType |
#
Type information about the response |
protected
string
|
$responseNotes |
#
Information about the response returned by the operation |
protected
boolean
|
$deprecated |
#
Whether or not the command is deprecated |
protected
array
|
$errorResponses |
#
Array of errors that could occur when running the command |
protected
|
$description | |
protected
array
|
$data |
#
Extra operation information |