Abstract Class Guzzle\Service\Command\AbstractCommand

InheritanceGuzzle\Service\Command\AbstractCommand » Guzzle\Common\Collection
ImplementsArrayAccess, Countable, Guzzle\Common\ToArrayInterface, Guzzle\Service\Command\CommandInterface, IteratorAggregate
SubclassesGuzzle\Service\Command\ClosureCommand, Guzzle\Service\Command\OperationCommand

Command object to handle preparing and processing client requests and responses of the requests

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$client Guzzle\Service\ClientInterface Client object used to execute the command Guzzle\Service\Command\AbstractCommand
$data array Data associated with the object. Guzzle\Common\Collection
$onComplete mixed Callable Guzzle\Service\Command\AbstractCommand
$operation Guzzle\Service\Description\OperationInterface API information about the command Guzzle\Service\Command\AbstractCommand
$request Guzzle\Http\Message\RequestInterface The request object associated with the command Guzzle\Service\Command\AbstractCommand
$result mixed The result of the command Guzzle\Service\Command\AbstractCommand
$validator Guzzle\Service\Description\ValidatorInterface Validator used to prepare and validate properties against a JSON schema Guzzle\Service\Command\AbstractCommand

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__clone() Custom clone behavior Guzzle\Service\Command\AbstractCommand
__construct() Guzzle\Service\Command\AbstractCommand
__invoke() Execute the command in the same manner as calling a function Guzzle\Service\Command\AbstractCommand
add() Add a value to a key. If a key of the same name has already been added, the key value will be converted into an array and the new value will be pushed to the end of the array. Guzzle\Common\Collection
clear() Removes all key value pairs Guzzle\Common\Collection
count() Guzzle\Common\Collection
execute() Guzzle\Service\Command\AbstractCommand
filter() Iterates over each key value pair in the collection passing them to the Closure. If the Closure function returns true, the current value from input is returned into the result Collection. The Closure must accept three parameters: (string) $key, (string) $value and return Boolean TRUE or FALSE for each value. Guzzle\Common\Collection
fromConfig() Create a new collection from an array, validate the keys, and add default values where missing Guzzle\Common\Collection
get() Get a specific key value. Guzzle\Common\Collection
getAll() Get all or a subset of matching key value pairs Guzzle\Common\Collection
getClient() Guzzle\Service\Command\AbstractCommand
getIterator() Guzzle\Common\Collection
getKeys() Get all keys in the collection Guzzle\Common\Collection
getName() Guzzle\Service\Command\AbstractCommand
getOperation() Get the API command information about the command Guzzle\Service\Command\AbstractCommand
getPath() Gets a value from the collection using an array path (e.g. foo/baz/bar would retrieve bar from two nested arrays) Allows for wildcard searches which recursively combine matches up to the level at which the wildcard occurs. This can be useful for accepting any key of a sub-array and combining matching keys from each diverging path. Guzzle\Common\Collection
getRequest() Guzzle\Service\Command\AbstractCommand
getRequestHeaders() Guzzle\Service\Command\AbstractCommand
getResponse() Guzzle\Service\Command\AbstractCommand
getResult() Guzzle\Service\Command\AbstractCommand
getValidationErrors() Get array of any validation errors If no validator has been set then return false Guzzle\Service\Command\AbstractCommand
hasKey() Returns whether or not the specified key is present. Guzzle\Common\Collection
hasValue() Checks if any keys contains a certain value Guzzle\Common\Collection
inject() Inject configuration settings into an input string Guzzle\Common\Collection
isExecuted() Guzzle\Service\Command\AbstractCommand
isPrepared() Guzzle\Service\Command\AbstractCommand
keySearch() Case insensitive search the keys in the collection Guzzle\Common\Collection
map() Returns a Collection containing all the elements of the collection after applying the callback function to each one. The Closure should accept three parameters: (string) $key, (string) $value, (array) $context and return a modified value Guzzle\Common\Collection
merge() Add and merge in a Collection or array of key value pair data. Guzzle\Common\Collection
offsetExists() Guzzle\Common\Collection
offsetGet() Guzzle\Common\Collection
offsetSet() Guzzle\Common\Collection
offsetUnset() Guzzle\Common\Collection
overwriteWith() Over write key value pairs in this collection with all of the data from an array or collection. Guzzle\Common\Collection
prepare() Guzzle\Service\Command\AbstractCommand
remove() Remove a specific key value pair Guzzle\Common\Collection
replace() Replace the data of the object with the value of an array Guzzle\Common\Collection
set() Set a key value pair Guzzle\Common\Collection
setClient() Guzzle\Service\Command\AbstractCommand
setOnComplete() Guzzle\Service\Command\AbstractCommand
setPath() Set a value into a nested array key. Keys will be created as needed to set the value. Guzzle\Common\Collection
setResult() Guzzle\Service\Command\AbstractCommand
setValidator() Set the validator used to validate and prepare command parameters and nested JSON schemas. If no validator is set, then the command will validate using the default {@see SchemaValidator}. Guzzle\Service\Command\AbstractCommand
toArray() Get the array representation of an object Guzzle\Common\ToArrayInterface

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
build() Create the request object that will carry out the command Guzzle\Service\Command\AbstractCommand
createOperation() Hook used to create an operation for concrete commands that are not associated with a service description Guzzle\Service\Command\AbstractCommand
getValidator() Get the validator used to prepare and validate properties. If no validator has been set on the command, then the default {@see SchemaValidator} will be used. Guzzle\Service\Command\AbstractCommand
init() Initialize the command (hook that can be implemented in subclasses) Guzzle\Service\Command\AbstractCommand
process() Create the result of the command after the request has been completed. Guzzle\Service\Command\AbstractCommand
validate() Validate and prepare the command based on the schema and rules defined by the command's Operation object Guzzle\Service\Command\AbstractCommand

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
DISABLE_VALIDATION 'command.disable_validation' Guzzle\Service\Command\AbstractCommand
HEADERS_OPTION 'command.headers' Guzzle\Service\Command\AbstractCommand
HIDDEN_PARAMS 'command.hidden_params' Guzzle\Service\Command\AbstractCommand
ON_COMPLETE 'command.on_complete' Guzzle\Service\Command\AbstractCommand
REQUEST_OPTIONS 'command.request_options' Guzzle\Service\Command\AbstractCommand
RESPONSE_BODY 'command.response_body' Guzzle\Service\Command\AbstractCommand
RESPONSE_PROCESSING 'command.response_processing' Guzzle\Service\Command\AbstractCommand
TYPE_MODEL 'model' Guzzle\Service\Command\AbstractCommand
TYPE_NO_TRANSLATION 'no_translation' Guzzle\Service\Command\AbstractCommand
TYPE_RAW 'raw' Guzzle\Service\Command\AbstractCommand

Property Details

$client protected property

Client object used to execute the command

$onComplete protected property

Callable

protected mixed $onComplete null
$operation protected property

API information about the command

$request protected property

The request object associated with the command

$result protected property

The result of the command

protected mixed $result null
$validator protected property

Validator used to prepare and validate properties against a JSON schema

Method Details

__clone() public method

Custom clone behavior

public void __clone ( )
__construct() public method

public void __construct ( $parameters = [], Guzzle\Service\Description\OperationInterface $operation null )
$parameters array|Guzzle\Common\Collection

Collection of parameters to set on the command

$operation Guzzle\Service\Description\OperationInterface

Command definition from description

__invoke() public method

Execute the command in the same manner as calling a function

public mixed __invoke ( )
return mixed

Returns the result of {@see AbstractCommand::execute}

build() protected abstract method

Create the request object that will carry out the command

protected abstract void build ( )
createOperation() protected method

Hook used to create an operation for concrete commands that are not associated with a service description

protected Guzzle\Service\Description\OperationInterface createOperation ( )
execute() public method

public void execute ( )
getClient() public method

public void getClient ( )
getName() public method

public void getName ( )
getOperation() public method

Get the API command information about the command

public Guzzle\Service\Description\OperationInterface getOperation ( )
getRequest() public method

public void getRequest ( )
getRequestHeaders() public method

public void getRequestHeaders ( )
getResponse() public method

public void getResponse ( )
getResult() public method

public void getResult ( )
getValidationErrors() public method

Get array of any validation errors If no validator has been set then return false

public void getValidationErrors ( )
getValidator() protected method

Get the validator used to prepare and validate properties. If no validator has been set on the command, then the default {@see SchemaValidator} will be used.

protected Guzzle\Service\Description\ValidatorInterface getValidator ( )
init() protected method

Initialize the command (hook that can be implemented in subclasses)

protected void init ( )
isExecuted() public method

public void isExecuted ( )
isPrepared() public method

public void isPrepared ( )
prepare() public method

public void prepare ( )
process() protected method

Create the result of the command after the request has been completed.

Override this method in subclasses to customize this behavior

protected void process ( )
setClient() public method

public void setClient ( Guzzle\Service\ClientInterface $client )
$client
setOnComplete() public method

public void setOnComplete ( $callable )
$callable
setResult() public method

public void setResult ( $result )
$result
setValidator() public method

Set the validator used to validate and prepare command parameters and nested JSON schemas. If no validator is set, then the command will validate using the default {@see SchemaValidator}.

public self setValidator ( Guzzle\Service\Description\ValidatorInterface $validator )
$validator Guzzle\Service\Description\ValidatorInterface

Validator used to prepare and validate properties against a JSON schema

validate() protected method

Validate and prepare the command based on the schema and rules defined by the command's Operation object

protected void validate ( )
throws Guzzle\Service\Exception\ValidationException

when validation errors occur