OperationCommand
        
        extends AbstractCommand
    
    
            
            in package
            
        
    
    
    
A command that creates requests based on {@see Guzzle\Service\Description\OperationInterface} objects, and if the matching operation uses a service description model in the responseClass attribute, then this command will marshal the response into an associative array based on the JSON schema of the model.
Table of Contents
Constants
- DISABLE_VALIDATION = 'command.disable_validation'
 - HEADERS_OPTION = 'command.headers'
 - HIDDEN_PARAMS = 'command.hidden_params'
 - ON_COMPLETE = 'command.on_complete'
 - REQUEST_OPTIONS = 'command.request_options'
 - RESPONSE_BODY = 'command.response_body'
 - RESPONSE_PROCESSING = 'command.response_processing'
 - TYPE_MODEL = 'model'
 - TYPE_NO_TRANSLATION = 'no_translation'
 - TYPE_RAW = 'raw'
 
Properties
- $client : ClientInterface
 - $data : array<string|int, mixed>
 - $onComplete : mixed
 - $operation : OperationInterface
 - $request : RequestInterface
 - $requestSerializer : RequestSerializerInterface
 - $responseParser : ResponseParserInterface
 - $result : mixed
 - $validator : ValidatorInterface
 
Methods
- __clone() : mixed
 - Custom clone behavior
 - __construct() : mixed
 - __invoke() : mixed
 - Execute the command in the same manner as calling a function
 - add() : Collection
 - 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.
 - clear() : Collection
 - Removes all key value pairs
 - count() : mixed
 - execute() : mixed
 - Execute the command and return the result
 - filter() : Collection
 - 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.
 - fromConfig() : self
 - Create a new collection from an array, validate the keys, and add default values where missing
 - get() : mixed|null
 - Get a specific key value.
 - getAll() : array<string|int, mixed>
 - Get all or a subset of matching key value pairs
 - getClient() : ClientInterface|null
 - Get the client object that will execute the command
 - getIterator() : mixed
 - getKeys() : array<string|int, mixed>
 - Get all keys in the collection
 - getName() : string
 - Get the short form name of the command
 - getOperation() : OperationInterface
 - Get the API command information about the command
 - getPath() : mixed|null
 - 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.
 - getRequest() : RequestInterface
 - Get the request object associated with the command
 - getRequestHeaders() : Collection
 - Get the object that manages the request headers that will be set on any outbound requests from the command
 - getRequestSerializer() : RequestSerializerInterface
 - Get the request serializer used with the command
 - getResponse() : Response
 - Get the response object associated with the command
 - getResponseParser() : ResponseParserInterface
 - Get the response parser used for the operation
 - getResult() : Response
 - Get the result of the command
 - getValidationErrors() : mixed
 - Get array of any validation errors If no validator has been set then return false
 - hasKey() : bool
 - Returns whether or not the specified key is present.
 - hasValue() : mixed
 - Checks if any keys contains a certain value
 - inject() : string
 - Inject configuration settings into an input string
 - isExecuted() : bool
 - Returns TRUE if the command has been executed
 - isPrepared() : bool
 - Returns TRUE if the command has been prepared for executing
 - keySearch() : bool|string
 - Case insensitive search the keys in the collection
 - map() : Collection
 - 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
 - merge() : Collection
 - Add and merge in a Collection or array of key value pair data.
 - offsetExists() : mixed
 - offsetGet() : mixed
 - offsetSet() : mixed
 - offsetUnset() : mixed
 - overwriteWith() : self
 - Over write key value pairs in this collection with all of the data from an array or collection.
 - prepare() : RequestInterface
 - Prepare the command for executing and create a request object.
 - remove() : Collection
 - Remove a specific key value pair
 - replace() : Collection
 - Replace the data of the object with the value of an array
 - set() : Collection
 - Set a key value pair
 - setClient() : self
 - Set the client object that will execute the command
 - setOnComplete() : self
 - Specify a callable to execute when the command completes
 - setPath() : self
 - Set a value into a nested array key. Keys will be created as needed to set the value.
 - setRequestSerializer() : self
 - Set the request serializer used with the command
 - setResponseParser() : self
 - Set the response parser used with the command
 - setResult() : self
 - Set the result of the command
 - setValidator() : self
 - 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}.
 - toArray() : array<string|int, mixed>
 - Get the array representation of an object
 - build() : mixed
 - Create the request object that will carry out the command
 - createOperation() : OperationInterface
 - Hook used to create an operation for concrete commands that are not associated with a service description
 - getValidator() : ValidatorInterface
 - 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.
 - init() : mixed
 - Initialize the command (hook that can be implemented in subclasses)
 - process() : mixed
 - Create the result of the command after the request has been completed.
 - validate() : mixed
 - Validate and prepare the command based on the schema and rules defined by the command's Operation object
 
Constants
DISABLE_VALIDATION
    public
        mixed
    DISABLE_VALIDATION
    = 'command.disable_validation'
    
    
    
    
HEADERS_OPTION
    public
        mixed
    HEADERS_OPTION
    = 'command.headers'
    
    
    
    
HIDDEN_PARAMS
    public
        mixed
    HIDDEN_PARAMS
    = 'command.hidden_params'
    
    
    
    
ON_COMPLETE
    public
        mixed
    ON_COMPLETE
    = 'command.on_complete'
    
    
    
    
REQUEST_OPTIONS
    public
        mixed
    REQUEST_OPTIONS
    = 'command.request_options'
    
    
    
    
RESPONSE_BODY
    public
        mixed
    RESPONSE_BODY
    = 'command.response_body'
    
    
    
    
RESPONSE_PROCESSING
    public
        mixed
    RESPONSE_PROCESSING
    = 'command.response_processing'
    
    
    
    
TYPE_MODEL
    public
        mixed
    TYPE_MODEL
    = 'model'
    
    
    
    
TYPE_NO_TRANSLATION
    public
        mixed
    TYPE_NO_TRANSLATION
    = 'no_translation'
    
    
    
    
TYPE_RAW
    public
        mixed
    TYPE_RAW
    = 'raw'
    
    
    
    
Properties
$client
    protected
        ClientInterface
    $client
    
    
        Client object used to execute the command
$data
    protected
        array<string|int, mixed>
    $data
    
    
        Data associated with the object.
$onComplete
    protected
        mixed
    $onComplete
    
    
        callable
$operation
    protected
        OperationInterface
    $operation
    
    
        API information about the command
$request
    protected
        RequestInterface
    $request
    
    
        The request object associated with the command
$requestSerializer
    protected
        RequestSerializerInterface
    $requestSerializer
    
    
    
    
    
$responseParser
    protected
        ResponseParserInterface
    $responseParser
    
    
        Response parser
$result
    protected
        mixed
    $result
    
    
        The result of the command
$validator
    protected
        ValidatorInterface
    $validator
    
    
        Validator used to prepare and validate properties against a JSON schema
Methods
__clone()
Custom clone behavior
    public
                    __clone() : mixed
    __construct()
    public
                    __construct([array<string|int, mixed>|Collection $parameters = array() ][, OperationInterface $operation = null ]) : mixed
    Parameters
- $parameters : array<string|int, mixed>|Collection = array()
 - 
                    
Collection of parameters to set on the command
 - $operation : OperationInterface = null
 - 
                    
Command definition from description
 
__invoke()
Execute the command in the same manner as calling a function
    public
                    __invoke() : mixed
    Return values
mixed —Returns the result of AbstractCommand::execute
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.
    public
                    add(string $key, mixed $value) : Collection
    Parameters
- $key : string
 - 
                    
Key to add
 - $value : mixed
 - 
                    
Value to add to the key
 
Return values
Collection —Returns a reference to the object.
clear()
Removes all key value pairs
    public
                    clear() : Collection
    Return values
Collectioncount()
    public
                    count() : mixed
    Attributes
- #[ReturnTypeWillChange]
 
execute()
Execute the command and return the result
    public
                    execute() : mixed
    Return values
mixed —Returns the result of CommandInterface::execute
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.
    public
                    filter(Closure $closure[, bool $static = true ]) : Collection
    Parameters
- $closure : Closure
 - 
                    
Closure evaluation function
 - $static : bool = true
 - 
                    
Set to TRUE to use the same class as the return rather than returning a Collection
 
Return values
CollectionfromConfig()
Create a new collection from an array, validate the keys, and add default values where missing
    public
            static        fromConfig([array<string|int, mixed> $config = array() ][, array<string|int, mixed> $defaults = array() ][, array<string|int, mixed> $required = array() ]) : self
    Parameters
- $config : array<string|int, mixed> = array()
 - 
                    
Configuration values to apply.
 - $defaults : array<string|int, mixed> = array()
 - 
                    
Default parameters
 - $required : array<string|int, mixed> = array()
 - 
                    
Required parameter names
 
Tags
Return values
selfget()
Get a specific key value.
    public
                    get(string $key) : mixed|null
    Parameters
- $key : string
 - 
                    
Key to retrieve.
 
Return values
mixed|null —Value of the key or NULL
getAll()
Get all or a subset of matching key value pairs
    public
                    getAll([array<string|int, mixed> $keys = null ]) : array<string|int, mixed>
    Parameters
- $keys : array<string|int, mixed> = null
 - 
                    
Pass an array of keys to retrieve only a subset of key value pairs
 
Return values
array<string|int, mixed> —Returns an array of all matching key value pairs
getClient()
Get the client object that will execute the command
    public
                    getClient() : ClientInterface|null
    Return values
ClientInterface|nullgetIterator()
    public
                    getIterator() : mixed
    Attributes
- #[ReturnTypeWillChange]
 
getKeys()
Get all keys in the collection
    public
                    getKeys() : array<string|int, mixed>
    Return values
array<string|int, mixed>getName()
Get the short form name of the command
    public
                    getName() : string
    Return values
stringgetOperation()
Get the API command information about the command
    public
                    getOperation() : OperationInterface
    Return values
OperationInterfacegetPath()
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.
    public
                    getPath(string $path[, string $separator = '/' ][, mixed $data = null ]) : mixed|null
    Parameters
- $path : string
 - 
                    
Path to traverse and retrieve a value from
 - $separator : string = '/'
 - 
                    
Character used to add depth to the search
 - $data : mixed = null
 - 
                    
Optional data to descend into (used when wildcards are encountered)
 
Return values
mixed|nullgetRequest()
Get the request object associated with the command
    public
                    getRequest() : RequestInterface
    Return values
RequestInterfacegetRequestHeaders()
Get the object that manages the request headers that will be set on any outbound requests from the command
    public
                    getRequestHeaders() : Collection
    Return values
CollectiongetRequestSerializer()
Get the request serializer used with the command
    public
                    getRequestSerializer() : RequestSerializerInterface
    Return values
RequestSerializerInterfacegetResponse()
Get the response object associated with the command
    public
                    getResponse() : Response
    Return values
ResponsegetResponseParser()
Get the response parser used for the operation
    public
                    getResponseParser() : ResponseParserInterface
    Return values
ResponseParserInterfacegetResult()
Get the result of the command
    public
                    getResult() : Response
    Return values
Response —By default, commands return a Response object unless overridden in a subclass
getValidationErrors()
Get array of any validation errors If no validator has been set then return false
    public
                    getValidationErrors() : mixed
    hasKey()
Returns whether or not the specified key is present.
    public
                    hasKey(string $key) : bool
    Parameters
- $key : string
 - 
                    
The key for which to check the existence.
 
Return values
boolhasValue()
Checks if any keys contains a certain value
    public
                    hasValue(string $value) : mixed
    Parameters
- $value : string
 - 
                    
Value to search for
 
Return values
mixed —Returns the key if the value was found FALSE if the value was not found.
inject()
Inject configuration settings into an input string
    public
                    inject(string $input) : string
    Parameters
- $input : string
 - 
                    
Input to inject
 
Return values
stringisExecuted()
Returns TRUE if the command has been executed
    public
                    isExecuted() : bool
    Return values
boolisPrepared()
Returns TRUE if the command has been prepared for executing
    public
                    isPrepared() : bool
    Return values
boolkeySearch()
Case insensitive search the keys in the collection
    public
                    keySearch(string $key) : bool|string
    Parameters
- $key : string
 - 
                    
Key to search for
 
Return values
bool|string —Returns false if not found, otherwise returns the key
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
    public
                    map(Closure $closure[, array<string|int, mixed> $context = array() ][, bool $static = true ]) : Collection
    Parameters
- $closure : Closure
 - 
                    
Closure to apply
 - $context : array<string|int, mixed> = array()
 - 
                    
Context to pass to the closure
 - $static : bool = true
 - 
                    
Set to TRUE to use the same class as the return rather than returning a Collection
 
Return values
Collectionmerge()
Add and merge in a Collection or array of key value pair data.
    public
                    merge(Collection|array<string|int, mixed> $data) : Collection
    Parameters
- $data : Collection|array<string|int, mixed>
 - 
                    
Associative array of key value pair data
 
Return values
Collection —Returns a reference to the object.
offsetExists()
    public
                    offsetExists(mixed $offset) : mixed
    Parameters
- $offset : mixed
 
Attributes
- #[ReturnTypeWillChange]
 
offsetGet()
    public
                    offsetGet(mixed $offset) : mixed
    Parameters
- $offset : mixed
 
Attributes
- #[ReturnTypeWillChange]
 
offsetSet()
    public
                    offsetSet(mixed $offset, mixed $value) : mixed
    Parameters
- $offset : mixed
 - $value : mixed
 
Attributes
- #[ReturnTypeWillChange]
 
offsetUnset()
    public
                    offsetUnset(mixed $offset) : mixed
    Parameters
- $offset : mixed
 
Attributes
- #[ReturnTypeWillChange]
 
overwriteWith()
Over write key value pairs in this collection with all of the data from an array or collection.
    public
                    overwriteWith(array<string|int, mixed>|Traversable $data) : self
    Parameters
- $data : array<string|int, mixed>|Traversable
 - 
                    
Values to override over this config
 
Return values
selfprepare()
Prepare the command for executing and create a request object.
    public
                    prepare() : RequestInterface
    Return values
RequestInterface —Returns the generated request
remove()
Remove a specific key value pair
    public
                    remove(string $key) : Collection
    Parameters
- $key : string
 - 
                    
A key to remove
 
Return values
Collectionreplace()
Replace the data of the object with the value of an array
    public
                    replace(array<string|int, mixed> $data) : Collection
    Parameters
- $data : array<string|int, mixed>
 - 
                    
Associative array of data
 
Return values
Collection —Returns a reference to the object
set()
Set a key value pair
    public
                    set(string $key, mixed $value) : Collection
    Parameters
- $key : string
 - 
                    
Key to set
 - $value : mixed
 - 
                    
Value to set
 
Return values
Collection —Returns a reference to the object
setClient()
Set the client object that will execute the command
    public
                    setClient(ClientInterface $client) : self
    Parameters
- $client : ClientInterface
 - 
                    
The client object that will execute the command
 
Return values
selfsetOnComplete()
Specify a callable to execute when the command completes
    public
                    setOnComplete(mixed $callable) : self
    Parameters
- $callable : mixed
 - 
                    
Callable to execute when the command completes. The callable must accept a CommandInterface object as the only argument.
 
Return values
selfsetPath()
Set a value into a nested array key. Keys will be created as needed to set the value.
    public
                    setPath(string $path, mixed $value) : self
    Parameters
- $path : string
 - 
                    
Path to set
 - $value : mixed
 - 
                    
Value to set at the key
 
Tags
Return values
selfsetRequestSerializer()
Set the request serializer used with the command
    public
                    setRequestSerializer(RequestSerializerInterface $serializer) : self
    Parameters
- $serializer : RequestSerializerInterface
 - 
                    
Request serializer
 
Return values
selfsetResponseParser()
Set the response parser used with the command
    public
                    setResponseParser(ResponseParserInterface $parser) : self
    Parameters
- $parser : ResponseParserInterface
 - 
                    
Response parser
 
Return values
selfsetResult()
Set the result of the command
    public
                    setResult(mixed $result) : self
    Parameters
- $result : mixed
 - 
                    
Result to set
 
Return values
selfsetValidator()
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
                    setValidator(ValidatorInterface $validator) : self
    Parameters
- $validator : ValidatorInterface
 - 
                    
Validator used to prepare and validate properties against a JSON schema
 
Return values
selftoArray()
Get the array representation of an object
    public
                    toArray() : array<string|int, mixed>
    Return values
array<string|int, mixed>build()
Create the request object that will carry out the command
    protected
                    build() : mixed
    createOperation()
Hook used to create an operation for concrete commands that are not associated with a service description
    protected
                    createOperation() : OperationInterface
    Return values
OperationInterfacegetValidator()
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
                    getValidator() : ValidatorInterface
    Return values
ValidatorInterfaceinit()
Initialize the command (hook that can be implemented in subclasses)
    protected
                    init() : mixed
    process()
Create the result of the command after the request has been completed.
    protected
                    process() : mixed
    Override this method in subclasses to customize this behavior
validate()
Validate and prepare the command based on the schema and rules defined by the command's Operation object
    protected
                    validate() : mixed