XOOPS  2.6.0
Xoops\Core\Service\Manager Class Reference

Public Member Functions

 listChoices ($service)
 
 locate ($service)
 
 readYamlProviderPrefs ()
 
 registerChoice ($service, $choices)
 
 saveChoice ($service, $choices)
 

Static Public Member Functions

static getInstance ()
 

Public Attributes

const MODE_CHOICE = 2
 
const MODE_EXCLUSIVE = 1
 
const MODE_MULTIPLE = 8
 
const MODE_PREFERENCE = 4
 
const PRIORITY_HIGH = 1
 
const PRIORITY_LOW = 9
 
const PRIORITY_MEDIUM = 5
 
const PRIORITY_SELECTED = 0
 

Protected Member Functions

 __construct ()
 
 readProviderPrefs ()
 
 saveProviderPrefs ($providerPrefs)
 

Protected Attributes

 $providerPrefs = null
 
 $services = array()
 

Private Attributes

 $providerPrefsCacheKey = 'system/provider/prefs'
 
 $providerPrefsFilename = 'var/configs/system_provider_prefs.yml'
 

Detailed Description

Definition at line 28 of file Manager.php.

Constructor & Destructor Documentation

Xoops\Core\Service\Manager::__construct ( )
protected

__construct

Definition at line 92 of file Manager.php.

References Xoops\Core\Service\Manager\readProviderPrefs().

Here is the call graph for this function:

Member Function Documentation

static Xoops\Core\Service\Manager::getInstance ( )
static

Allow one instance only!

Returns
Manager instance

Definition at line 102 of file Manager.php.

Xoops\Core\Service\Manager::listChoices (   $service)

listChoices - list choices availabe for a named service

For MODE_CHOICE services, this can supply an array containing the available choices. This array can be used to construct a user form to make a choice.

Parameters
string$servicethe service name being set
Returns
array of available service provider objects for this service.

Definition at line 233 of file Manager.php.

References Xoops\Core\Service\Manager\locate().

Here is the call graph for this function:

Xoops\Core\Service\Manager::locate (   $service)

locate - create a provider object for a named service, locating all contract implementors

Parameters
string$servicethe service name being set
Returns
Provider object for the requested service

Definition at line 246 of file Manager.php.

References $name, $xoops, and Xoops\getInstance().

Referenced by Xoops\Core\Service\Manager\listChoices(), and Xoops\Core\Service\Manager\registerChoice().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\Service\Manager::readProviderPrefs ( )
protected

readProviderPrefs - read configured provider preferences from cache

Returns
array of configured provider preferences

Definition at line 144 of file Manager.php.

References Xoops\Core\Service\Manager\$providerPrefs, $xoops, and Xoops\getInstance().

Referenced by Xoops\Core\Service\Manager\__construct(), and Xoops\Core\Service\Manager\saveChoice().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\Service\Manager::readYamlProviderPrefs ( )

readYamlProviderPrefs - read configured provider preferences from file

Returns
array of configured provider preferences

Definition at line 118 of file Manager.php.

References $file, Xoops\Core\Service\Manager\$providerPrefs, $xoops, Xoops\getInstance(), and Xoops\Core\Yaml\read().

Here is the call graph for this function:

Xoops\Core\Service\Manager::registerChoice (   $service,
  $choices 
)

registerChoice - record priority choices for service providers

This registers a temporary choice (i.e. applying user preferences) for the lifetime of this service manager only.

Parameters
string$servicethe service name being set
array$choicesarray of priorities for each of the named service providers
Returns
void

Definition at line 209 of file Manager.php.

References $name, and Xoops\Core\Service\Manager\locate().

Referenced by Xoops\Core\Service\Manager\saveChoice().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\Service\Manager::saveChoice (   $service,
  $choices 
)

saveChoice - record priority choices for service providers

This registers a permanent choice (i.e. setting system default) that will persist after the lifetime of this service manager.

Parameters
string$servicethe service name being set
array$choicesarray of priorities for each of the named service providers
Returns
void

Definition at line 186 of file Manager.php.

References Xoops\Core\Service\Manager\readProviderPrefs(), Xoops\Core\Service\Manager\registerChoice(), and Xoops\Core\Service\Manager\saveProviderPrefs().

Here is the call graph for this function:

Xoops\Core\Service\Manager::saveProviderPrefs (   $providerPrefs)
protected

saveProviderPrefs - record array of provider preferences in config file, and update cache

Parameters
array$providerPrefsarray of provider preferences to save
Returns
void

Definition at line 162 of file Manager.php.

References Xoops\Core\Service\Manager\$providerPrefs, $xoops, Xoops\getInstance(), and Xoops\Core\Yaml\save().

Referenced by Xoops\Core\Service\Manager\saveChoice().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Xoops\Core\Service\Manager::$providerPrefs = null
protected
Xoops\Core\Service\Manager::$providerPrefsCacheKey = 'system/provider/prefs'
private

Definition at line 87 of file Manager.php.

Xoops\Core\Service\Manager::$providerPrefsFilename = 'var/configs/system_provider_prefs.yml'
private

Definition at line 82 of file Manager.php.

Xoops\Core\Service\Manager::$services = array()
protected

Definition at line 69 of file Manager.php.

const Xoops\Core\Service\Manager::MODE_CHOICE = 2

Service Mode constant - Choice mode where one service from potentially many located services will be used. The service dispatched will be selected by system default.

Definition at line 41 of file Manager.php.

const Xoops\Core\Service\Manager::MODE_EXCLUSIVE = 1

Service Mode constant - Exclusive mode where only one located service will be used.

Definition at line 34 of file Manager.php.

Referenced by Xoops\Core\Service\Provider\getProviderMode().

const Xoops\Core\Service\Manager::MODE_MULTIPLE = 8

Service Mode constant - Multiple mode where all located services will be dispatched in priority order.

Definition at line 54 of file Manager.php.

const Xoops\Core\Service\Manager::MODE_PREFERENCE = 4

Service Mode constant - Choice mode where one service from potentially many located services will be used. The service dispatched will be selected by user preference, or system default if no user valid preference is available.

Definition at line 48 of file Manager.php.

const Xoops\Core\Service\Manager::PRIORITY_HIGH = 1

Definition at line 60 of file Manager.php.

const Xoops\Core\Service\Manager::PRIORITY_LOW = 9

Definition at line 62 of file Manager.php.

const Xoops\Core\Service\Manager::PRIORITY_MEDIUM = 5

Definition at line 61 of file Manager.php.

const Xoops\Core\Service\Manager::PRIORITY_SELECTED = 0

Provider priorities

Definition at line 59 of file Manager.php.


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