Open Journal Systems  3.3.0
Guzzle\Service\Builder\ServiceBuilder Class Reference
Inheritance diagram for Guzzle\Service\Builder\ServiceBuilder:
Guzzle\Common\AbstractHasDispatcher Guzzle\Service\Builder\ServiceBuilderInterface Guzzle\Common\HasDispatcherInterface

Public Member Functions

 __construct (array $serviceBuilderConfig=array())
 
 addGlobalPlugin (EventSubscriberInterface $plugin)
 
 get ($name, $throwAway=false)
 
 getData ($name)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 serialize ()
 
 set ($key, $service)
 
 unserialize ($serialized)
 
- Public Member Functions inherited from Guzzle\Common\AbstractHasDispatcher
 addSubscriber (EventSubscriberInterface $subscriber)
 
 dispatch ($eventName, array $context=array())
 
 getEventDispatcher ()
 
 setEventDispatcher (EventDispatcherInterface $eventDispatcher)
 

Static Public Member Functions

static factory ($config=null, array $globalParameters=array())
 
static getAllEvents ()
 

Protected Attributes

 $builderConfig = array()
 
 $clients = array()
 
 $plugins = array()
 
- Protected Attributes inherited from Guzzle\Common\AbstractHasDispatcher
 $eventDispatcher
 

Static Protected Attributes

static $cachedFactory
 

Detailed Description

{}

Clients and data can be set, retrieved, and removed by accessing the service builder like an associative array.

Definition at line 16 of file ServiceBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

Guzzle\Service\Builder\ServiceBuilder::__construct ( array  $serviceBuilderConfig = array())
Parameters
array$serviceBuilderConfigService configuration settings:
  • name: Name of the service
  • class: Client class to instantiate using a factory method
  • params: array of key value pair configuration settings for the builder

Definition at line 67 of file ServiceBuilder.php.

Member Function Documentation

◆ addGlobalPlugin()

Guzzle\Service\Builder\ServiceBuilder::addGlobalPlugin ( EventSubscriberInterface  $plugin)

Attach a plugin to every client created by the builder

Parameters
EventSubscriberInterface$pluginPlugin to attach to each client
Returns
self

Definition at line 94 of file ServiceBuilder.php.

◆ factory()

static Guzzle\Service\Builder\ServiceBuilder::factory (   $config = null,
array  $globalParameters = array() 
)
static

◆ get()

Guzzle\Service\Builder\ServiceBuilder::get (   $name,
  $throwAway = false 
)

Get a ClientInterface object or arbitrary data from the service builder

Parameters
string$nameName of the registered service or data to retrieve
bool | array$throwAwayOnly pertains to retrieving client objects built using a configuration array. Set to TRUE to not store the client for later retrieval from the ServiceBuilder. If an array is specified, that data will overwrite the configured params of the client if the client implements {
See also
\Guzzle\Common\FromConfigInterface} and will not store the client for later retrieval.
Returns
\Guzzle\Service\ClientInterface|mixed
Exceptions
ServiceNotFoundExceptionwhen a client or data cannot be found by the given name

Implements Guzzle\Service\Builder\ServiceBuilderInterface.

Definition at line 113 of file ServiceBuilder.php.

References Guzzle\Common\AbstractHasDispatcher\dispatch(), and Guzzle\Service\Builder\ServiceBuilder\factory().

◆ getAllEvents()

static Guzzle\Service\Builder\ServiceBuilder::getAllEvents ( )
static

Get a list of all of the events emitted from the class

Returns
array

Reimplemented from Guzzle\Common\AbstractHasDispatcher.

Definition at line 72 of file ServiceBuilder.php.

Referenced by Guzzle\Tests\Service\ServiceBuilderTest\testEmitsEventsWhenClientsAreCreated().

◆ getData()

Guzzle\Service\Builder\ServiceBuilder::getData (   $name)

Get data from the service builder without triggering the building of a service

Parameters
string$nameName of the service to retrieve
Returns
array|null

Definition at line 108 of file ServiceBuilder.php.

◆ offsetExists()

Guzzle\Service\Builder\ServiceBuilder::offsetExists (   $offset)

Definition at line 189 of file ServiceBuilder.php.

◆ offsetGet()

Guzzle\Service\Builder\ServiceBuilder::offsetGet (   $offset)

Definition at line 194 of file ServiceBuilder.php.

◆ offsetSet()

Guzzle\Service\Builder\ServiceBuilder::offsetSet (   $offset,
  $value 
)

Definition at line 178 of file ServiceBuilder.php.

◆ offsetUnset()

Guzzle\Service\Builder\ServiceBuilder::offsetUnset (   $offset)

Definition at line 183 of file ServiceBuilder.php.

◆ serialize()

Guzzle\Service\Builder\ServiceBuilder::serialize ( )

Definition at line 82 of file ServiceBuilder.php.

◆ set()

Guzzle\Service\Builder\ServiceBuilder::set (   $key,
  $service 
)

Register a service or arbitrary data by name with the service builder

Parameters
string$keyName of the client or data to register
mixed$serviceClient configuration array or arbitrary data to register. The client configuration array must include a 'class' (string) and 'params' (array) key.
Returns
ServiceBuilderInterface

Implements Guzzle\Service\Builder\ServiceBuilderInterface.

Definition at line 167 of file ServiceBuilder.php.

◆ unserialize()

Guzzle\Service\Builder\ServiceBuilder::unserialize (   $serialized)

Definition at line 77 of file ServiceBuilder.php.

Field Documentation

◆ $builderConfig

array Guzzle\Service\Builder\ServiceBuilder::$builderConfig = array()
protected

Service builder configuration data

Definition at line 22 of file ServiceBuilder.php.

◆ $cachedFactory

Guzzle\Service\Builder\ServiceBuilder::$cachedFactory
staticprotected

Cached instance of the service builder loader

Definition at line 32 of file ServiceBuilder.php.

◆ $clients

array Guzzle\Service\Builder\ServiceBuilder::$clients = array()
protected

Instantiated client objects

Definition at line 28 of file ServiceBuilder.php.

◆ $plugins

ServiceBuilderLoader Guzzle\Service\Builder\ServiceBuilder::$plugins = array()
protected

Definition at line 37 of file ServiceBuilder.php.


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