\Guzzle\Service\CommandCommandInterface

A command object that contains parameters that can be modified and accessed like an array and turned into an array

Summary

Methods
Constants
toArray()
getName()
getOperation()
execute()
getClient()
setClient()
getRequest()
getResponse()
getResult()
setResult()
isPrepared()
isExecuted()
prepare()
getRequestHeaders()
setOnComplete()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

toArray()

toArray() : array

Get the array representation of an object

Returns

array

getName()

getName() : string

Get the short form name of the command

Returns

string

execute()

execute() : mixed

Execute the command and return the result

Throws

\Guzzle\Service\Exception\CommandException

if a client has not been associated with the command

Returns

mixed —

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

getClient()

getClient() : \Guzzle\Service\ClientInterface|null

Get the client object that will execute the command

Returns

\Guzzle\Service\ClientInterface|null

setClient()

setClient(\Guzzle\Service\ClientInterface  $client) : self

Set the client object that will execute the command

Parameters

\Guzzle\Service\ClientInterface $client

The client object that will execute the command

Returns

self

getRequest()

getRequest() : \Guzzle\Http\Message\RequestInterface

Get the request object associated with the command

Throws

\Guzzle\Service\Exception\CommandException

if the command has not been executed

Returns

\Guzzle\Http\Message\RequestInterface

getResponse()

getResponse() : \Guzzle\Http\Message\Response

Get the response object associated with the command

Throws

\Guzzle\Service\Exception\CommandException

if the command has not been executed

Returns

\Guzzle\Http\Message\Response

getResult()

getResult() : \Guzzle\Http\Message\Response

Get the result of the command

Throws

\Guzzle\Service\Exception\CommandException

if the command has not been executed

Returns

\Guzzle\Http\Message\Response

By default, commands return a Response object unless overridden in a subclass

setResult()

setResult(mixed  $result) : self

Set the result of the command

Parameters

mixed $result

Result to set

Returns

self

isPrepared()

isPrepared() : boolean

Returns TRUE if the command has been prepared for executing

Returns

boolean

isExecuted()

isExecuted() : boolean

Returns TRUE if the command has been executed

Returns

boolean

prepare()

prepare() : \Guzzle\Http\Message\RequestInterface

Prepare the command for executing and create a request object.

Throws

\Guzzle\Service\Exception\CommandException

if a client object has not been set previously or in the prepare()

Returns

\Guzzle\Http\Message\RequestInterface

Returns the generated request

getRequestHeaders()

getRequestHeaders() : \Guzzle\Common\Collection

Get the object that manages the request headers that will be set on any outbound requests from the command

Returns

\Guzzle\Common\Collection

setOnComplete()

setOnComplete(mixed  $callable) : self

Specify a callable to execute when the command completes

Parameters

mixed $callable

Callable to execute when the command completes. The callable must accept a {@see CommandInterface} object as the only argument.

Throws

\Guzzle\Common\Exception\InvalidArgumentException

Returns

self