Open Journal Systems  3.3.0
Guzzle\Service\Command\AbstractCommand Class Reference
Inheritance diagram for Guzzle\Service\Command\AbstractCommand:
Guzzle\Common\Collection Guzzle\Service\Command\CommandInterface Guzzle\Common\ToArrayInterface Guzzle\Common\ToArrayInterface Guzzle\Service\Command\ClosureCommand Guzzle\Service\Command\OperationCommand Guzzle\Tests\Service\Mock\Command\MockCommand Guzzle\Tests\Service\Mock\Command\IterableCommand Guzzle\Tests\Service\Mock\Command\OtherCommand Guzzle\Tests\Service\Mock\Command\Sub\Sub

Public Member Functions

 __clone ()
 
 __construct ($parameters=array(), OperationInterface $operation=null)
 
 __invoke ()
 
 execute ()
 
 getClient ()
 
 getName ()
 
 getOperation ()
 
 getRequest ()
 
 getRequestHeaders ()
 
 getResponse ()
 
 getResult ()
 
 getValidationErrors ()
 
 isExecuted ()
 
 isPrepared ()
 
 prepare ()
 
 setClient (ClientInterface $client)
 
 setOnComplete ($callable)
 
 setResult ($result)
 
 setValidator (ValidatorInterface $validator)
 
- Public Member Functions inherited from Guzzle\Common\Collection
 __construct (array $data=array())
 
 add ($key, $value)
 
 clear ()
 
 count ()
 
 filter (\Closure $closure, $static=true)
 
 get ($key)
 
 getAll (array $keys=null)
 
 getIterator ()
 
 getKeys ()
 
 getPath ($path, $separator='/', $data=null)
 
 hasKey ($key)
 
 hasValue ($value)
 
 inject ($input)
 
 keySearch ($key)
 
 map (\Closure $closure, array $context=array(), $static=true)
 
 merge ($data)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 overwriteWith ($data)
 
 remove ($key)
 
 replace (array $data)
 
 set ($key, $value)
 
 setPath ($path, $value)
 
 toArray ()
 

Data Fields

const DISABLE_VALIDATION = 'command.disable_validation'
 
const HEADERS_OPTION = 'command.headers'
 
const HIDDEN_PARAMS = 'command.hidden_params'
 
const ON_COMPLETE = 'command.on_complete'
 
const REQUEST_OPTIONS = 'command.request_options'
 
const RESPONSE_BODY = 'command.response_body'
 
const RESPONSE_PROCESSING = 'command.response_processing'
 
const TYPE_MODEL = 'model'
 
const TYPE_NO_TRANSLATION = 'no_translation'
 
const TYPE_RAW = 'raw'
 

Protected Member Functions

 build ()
 
 createOperation ()
 
 getValidator ()
 
 init ()
 
 process ()
 
 validate ()
 

Protected Attributes

 $client
 
 $onComplete
 
 $operation
 
 $request
 
 $result
 
 $validator
 
- Protected Attributes inherited from Guzzle\Common\Collection
 $data
 

Additional Inherited Members

- Static Public Member Functions inherited from Guzzle\Common\Collection
static fromConfig (array $config=array(), array $defaults=array(), array $required=array())
 

Detailed Description

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

Definition at line 21 of file AbstractCommand.php.

Constructor & Destructor Documentation

◆ __construct()

Guzzle\Service\Command\AbstractCommand::__construct (   $parameters = array(),
OperationInterface  $operation = null 
)

Member Function Documentation

◆ __clone()

Guzzle\Service\Command\AbstractCommand::__clone ( )

Custom clone behavior

Definition at line 123 of file AbstractCommand.php.

◆ __invoke()

Guzzle\Service\Command\AbstractCommand::__invoke ( )

Execute the command in the same manner as calling a function

Returns
mixed Returns the result of {
See also
AbstractCommand::execute}

Definition at line 134 of file AbstractCommand.php.

References Guzzle\Service\Command\AbstractCommand\execute().

◆ build()

◆ createOperation()

Guzzle\Service\Command\AbstractCommand::createOperation ( )
protected

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

Returns
OperationInterface

Reimplemented in Guzzle\Tests\Service\Mock\Command\IterableCommand, Guzzle\Tests\Service\Mock\Command\MockCommand, and Guzzle\Tests\Service\Mock\Command\OtherCommand.

Definition at line 316 of file AbstractCommand.php.

Referenced by Guzzle\Service\Command\AbstractCommand\__construct().

◆ execute()

Guzzle\Service\Command\AbstractCommand::execute ( )

Execute the command and return the result

Returns
mixed Returns the result of {
See also
CommandInterface::execute}
Exceptions
CommandExceptionif a client has not been associated with the command

Implements Guzzle\Service\Command\CommandInterface.

Definition at line 165 of file AbstractCommand.php.

Referenced by Guzzle\Service\Command\AbstractCommand\__invoke(), Guzzle\Service\Command\AbstractCommand\getResponse(), and Guzzle\Service\Command\AbstractCommand\getResult().

◆ getClient()

Guzzle\Service\Command\AbstractCommand::getClient ( )

Get the client object that will execute the command

Returns
ClientInterface|null

Implements Guzzle\Service\Command\CommandInterface.

Definition at line 174 of file AbstractCommand.php.

References Guzzle\Service\Command\AbstractCommand\$client.

◆ getName()

Guzzle\Service\Command\AbstractCommand::getName ( )

Get the short form name of the command

Returns
string

Implements Guzzle\Service\Command\CommandInterface.

Definition at line 139 of file AbstractCommand.php.

◆ getOperation()

Guzzle\Service\Command\AbstractCommand::getOperation ( )

Get the API command information about the command

Returns
OperationInterface

Implements Guzzle\Service\Command\CommandInterface.

Definition at line 149 of file AbstractCommand.php.

References Guzzle\Service\Command\AbstractCommand\$operation.

◆ getRequest()

Guzzle\Service\Command\AbstractCommand::getRequest ( )

Get the request object associated with the command

Returns
RequestInterface
Exceptions
CommandExceptionif the command has not been executed

Implements Guzzle\Service\Command\CommandInterface.

Definition at line 186 of file AbstractCommand.php.

References Guzzle\Service\Command\AbstractCommand\$request.

◆ getRequestHeaders()

Guzzle\Service\Command\AbstractCommand::getRequestHeaders ( )

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

Returns
Collection

Implements Guzzle\Service\Command\CommandInterface.

Definition at line 296 of file AbstractCommand.php.

References Guzzle\Service\Command\AbstractCommand\HEADERS_OPTION.

◆ getResponse()

Guzzle\Service\Command\AbstractCommand::getResponse ( )

Get the response object associated with the command

Returns
Response
Exceptions
CommandExceptionif the command has not been executed

Implements Guzzle\Service\Command\CommandInterface.

Definition at line 195 of file AbstractCommand.php.

References Guzzle\Service\Command\AbstractCommand\execute(), and Guzzle\Service\Command\AbstractCommand\isExecuted().

◆ getResult()

Guzzle\Service\Command\AbstractCommand::getResult ( )

Get the result of the command

Returns
Response By default, commands return a Response object unless overridden in a subclass
Exceptions
CommandExceptionif the command has not been executed

Implements Guzzle\Service\Command\CommandInterface.

Definition at line 204 of file AbstractCommand.php.

References Guzzle\Service\Command\AbstractCommand\$result, Guzzle\Service\Command\AbstractCommand\execute(), Guzzle\Service\Command\AbstractCommand\isExecuted(), and Guzzle\Service\Command\AbstractCommand\process().

◆ getValidationErrors()

Guzzle\Service\Command\AbstractCommand::getValidationErrors ( )

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

Definition at line 400 of file AbstractCommand.php.

◆ getValidator()

Guzzle\Service\Command\AbstractCommand::getValidator ( )
protected

Get the validator used to prepare and validate properties. If no validator has been set on the command, then the default {

See also
SchemaValidator} will be used.
Returns
ValidatorInterface

Definition at line 387 of file AbstractCommand.php.

References Guzzle\Service\Command\AbstractCommand\$validator, and Guzzle\Service\Description\SchemaValidator\getInstance().

Referenced by Guzzle\Service\Command\AbstractCommand\validate().

◆ init()

Guzzle\Service\Command\AbstractCommand::init ( )
protected

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

Reimplemented in Guzzle\Service\Command\ClosureCommand.

Definition at line 304 of file AbstractCommand.php.

Referenced by Guzzle\Service\Command\AbstractCommand\__construct().

◆ isExecuted()

Guzzle\Service\Command\AbstractCommand::isExecuted ( )

Returns TRUE if the command has been executed

Returns
bool

Implements Guzzle\Service\Command\CommandInterface.

Definition at line 233 of file AbstractCommand.php.

Referenced by Guzzle\Service\Command\AbstractCommand\getResponse(), and Guzzle\Service\Command\AbstractCommand\getResult().

◆ isPrepared()

Guzzle\Service\Command\AbstractCommand::isPrepared ( )

Returns TRUE if the command has been prepared for executing

Returns
bool

Implements Guzzle\Service\Command\CommandInterface.

Definition at line 228 of file AbstractCommand.php.

Referenced by Guzzle\Service\Command\AbstractCommand\prepare().

◆ prepare()

Guzzle\Service\Command\AbstractCommand::prepare ( )

◆ process()

Guzzle\Service\Command\AbstractCommand::process ( )
protected

Create the result of the command after the request has been completed. Override this method in subclasses to customize this behavior

Reimplemented in Guzzle\Service\Command\OperationCommand.

Definition at line 325 of file AbstractCommand.php.

References Guzzle\Service\Command\DefaultResponseParser\getInstance(), and Guzzle\Service\Command\AbstractCommand\RESPONSE_PROCESSING.

Referenced by Guzzle\Service\Command\AbstractCommand\getResult().

◆ setClient()

Guzzle\Service\Command\AbstractCommand::setClient ( ClientInterface  $client)

Set the client object that will execute the command

Parameters
ClientInterface$clientThe client object that will execute the command
Returns
self

Implements Guzzle\Service\Command\CommandInterface.

Definition at line 179 of file AbstractCommand.php.

References Guzzle\Service\Command\AbstractCommand\$client.

◆ setOnComplete()

Guzzle\Service\Command\AbstractCommand::setOnComplete (   $callable)

Specify a callable to execute when the command completes

Parameters
mixed$callableCallable to execute when the command completes. The callable must accept a {
See also
CommandInterface} object as the only argument.
Returns
self
Exceptions
InvalidArgumentException

Implements Guzzle\Service\Command\CommandInterface.

Definition at line 154 of file AbstractCommand.php.

Referenced by Guzzle\Service\Command\AbstractCommand\__construct().

◆ setResult()

Guzzle\Service\Command\AbstractCommand::setResult (   $result)

Set the result of the command

Parameters
mixed$resultResult to set
Returns
self

Implements Guzzle\Service\Command\CommandInterface.

Definition at line 221 of file AbstractCommand.php.

References Guzzle\Service\Command\AbstractCommand\$result.

◆ setValidator()

Guzzle\Service\Command\AbstractCommand::setValidator ( ValidatorInterface  $validator)

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 also
SchemaValidator}.
Parameters
ValidatorInterface$validatorValidator used to prepare and validate properties against a JSON schema
Returns
self

Definition at line 289 of file AbstractCommand.php.

References Guzzle\Service\Command\AbstractCommand\$validator.

◆ validate()

Guzzle\Service\Command\AbstractCommand::validate ( )
protected

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

Exceptions
ValidationExceptionwhen validation errors occur

Definition at line 337 of file AbstractCommand.php.

References Guzzle\Service\Command\AbstractCommand\$validator, Guzzle\Service\Command\AbstractCommand\getValidator(), Guzzle\Service\Command\AbstractCommand\HIDDEN_PARAMS, and Guzzle\Common\Collection\toArray().

Referenced by Guzzle\Service\Command\AbstractCommand\prepare().

Field Documentation

◆ $client

ClientInterface Guzzle\Service\Command\AbstractCommand::$client
protected

Client object used to execute the command

Definition at line 47 of file AbstractCommand.php.

Referenced by Guzzle\Service\Command\AbstractCommand\getClient(), and Guzzle\Service\Command\AbstractCommand\setClient().

◆ $onComplete

mixed Guzzle\Service\Command\AbstractCommand::$onComplete
protected

callable

Definition at line 71 of file AbstractCommand.php.

Referenced by Guzzle\Service\Command\AbstractCommand\__construct().

◆ $operation

OperationInterface Guzzle\Service\Command\AbstractCommand::$operation
protected

API information about the command

Definition at line 65 of file AbstractCommand.php.

Referenced by Guzzle\Service\Command\AbstractCommand\__construct(), and Guzzle\Service\Command\AbstractCommand\getOperation().

◆ $request

RequestInterface Guzzle\Service\Command\AbstractCommand::$request
protected

The request object associated with the command

Definition at line 53 of file AbstractCommand.php.

Referenced by Guzzle\Service\Command\AbstractCommand\getRequest(), and Guzzle\Service\Command\AbstractCommand\prepare().

◆ $result

mixed Guzzle\Service\Command\AbstractCommand::$result
protected

◆ $validator

ValidatorInterface Guzzle\Service\Command\AbstractCommand::$validator
protected

◆ DISABLE_VALIDATION

const Guzzle\Service\Command\AbstractCommand::DISABLE_VALIDATION = 'command.disable_validation'

◆ HEADERS_OPTION

◆ HIDDEN_PARAMS

const Guzzle\Service\Command\AbstractCommand::HIDDEN_PARAMS = 'command.hidden_params'

◆ ON_COMPLETE

const Guzzle\Service\Command\AbstractCommand::ON_COMPLETE = 'command.on_complete'

Definition at line 26 of file AbstractCommand.php.

◆ REQUEST_OPTIONS

const Guzzle\Service\Command\AbstractCommand::REQUEST_OPTIONS = 'command.request_options'

◆ RESPONSE_BODY

const Guzzle\Service\Command\AbstractCommand::RESPONSE_BODY = 'command.response_body'

◆ RESPONSE_PROCESSING

◆ TYPE_MODEL

const Guzzle\Service\Command\AbstractCommand::TYPE_MODEL = 'model'

◆ TYPE_NO_TRANSLATION

const Guzzle\Service\Command\AbstractCommand::TYPE_NO_TRANSLATION = 'no_translation'

Definition at line 41 of file AbstractCommand.php.

◆ TYPE_RAW

const Guzzle\Service\Command\AbstractCommand::TYPE_RAW = 'raw'

The documentation for this class was generated from the following file: