Class Guzzle\Service\Command\ClosureCommand

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

A ClosureCommand is a command that allows dynamic commands to be created at runtime using a closure to prepare the request. A closure key and \Closure value must be passed to the command in the constructor. The closure must accept the command object as an argument.

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() {@inheritdoc} Guzzle\Service\Command\ClosureCommand
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() {@inheritdoc} Guzzle\Service\Command\ClosureCommand
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

Method Details

build() protected method

{@inheritdoc}

protected void build ( )
throws Guzzle\Common\Exception\UnexpectedValueException

If the closure does not return a request

init() protected method

{@inheritdoc}

protected void init ( )
throws Guzzle\Common\Exception\InvalidArgumentException

if a closure was not passed