Open Journal Systems  3.3.0
Guzzle\Service\AbstractConfigLoader Class Reference
Inheritance diagram for Guzzle\Service\AbstractConfigLoader:
Guzzle\Service\ConfigLoaderInterface Guzzle\Service\Builder\ServiceBuilderLoader Guzzle\Service\Description\ServiceDescriptionLoader

Public Member Functions

 addAlias ($filename, $alias)
 
 load ($config, array $options=array())
 
 removeAlias ($alias)
 

Protected Member Functions

 build ($config, array $options)
 
 loadFile ($filename)
 
 mergeData (array $a, array $b)
 
 mergeIncludes (&$config, $basePath=null)
 

Protected Attributes

 $aliases = array()
 
 $loadedFiles = array()
 

Static Protected Attributes

static $jsonErrors
 

Detailed Description

Abstract config loader

Definition at line 11 of file AbstractConfigLoader.php.

Member Function Documentation

◆ addAlias()

Guzzle\Service\AbstractConfigLoader::addAlias (   $filename,
  $alias 
)

Add an include alias to the loader

Parameters
string$filenameFilename to alias (e.g. _foo)
string$aliasActual file to use (e.g. /path/to/foo.json)
Returns
self

Definition at line 59 of file AbstractConfigLoader.php.

◆ build()

Guzzle\Service\AbstractConfigLoader::build (   $config,
array  $options 
)
abstractprotected

Perform the parsing of a config file and create the end result

Parameters
array$configConfiguration data
array$optionsOptions to use when building
Returns
mixed

Reimplemented in Guzzle\Service\Builder\ServiceBuilderLoader, and Guzzle\Service\Description\ServiceDescriptionLoader.

Referenced by Guzzle\Service\AbstractConfigLoader\load().

◆ load()

Guzzle\Service\AbstractConfigLoader::load (   $config,
array  $options = array() 
)

Loads configuration data and returns an array of the loaded result

Parameters
mixed$configData to load (filename or array of data)
array$optionsArray of options to use when loading
Returns
mixed

Implements Guzzle\Service\ConfigLoaderInterface.

Definition at line 35 of file AbstractConfigLoader.php.

References Guzzle\Service\AbstractConfigLoader\build(), Guzzle\Service\AbstractConfigLoader\loadFile(), and Guzzle\Service\AbstractConfigLoader\mergeIncludes().

◆ loadFile()

Guzzle\Service\AbstractConfigLoader::loadFile (   $filename)
protected

Load a configuration file (can load JSON or PHP files that return an array when included)

Parameters
string$filenameFile to load
Returns
array
Exceptions
InvalidArgumentException
RuntimeExceptionwhen the JSON cannot be parsed

Definition at line 99 of file AbstractConfigLoader.php.

References Guzzle\Service\AbstractConfigLoader\mergeIncludes().

Referenced by Guzzle\Service\AbstractConfigLoader\load(), and Guzzle\Service\AbstractConfigLoader\mergeIncludes().

◆ mergeData()

Guzzle\Service\AbstractConfigLoader::mergeData ( array  $a,
array  $b 
)
protected

Default implementation for merging two arrays of data (uses array_merge_recursive)

Parameters
array$aOriginal data
array$bData to merge into the original and overwrite existing values
Returns
array

Reimplemented in Guzzle\Service\Builder\ServiceBuilderLoader.

Definition at line 179 of file AbstractConfigLoader.php.

Referenced by Guzzle\Service\AbstractConfigLoader\mergeIncludes().

◆ mergeIncludes()

Guzzle\Service\AbstractConfigLoader::mergeIncludes ( $config,
  $basePath = null 
)
protected

Merges in all include files

Parameters
array$configConfig data that contains includes
string$basePathBase path to use when a relative path is encountered
Returns
array Returns the merged and included data

Definition at line 154 of file AbstractConfigLoader.php.

References Guzzle\Service\AbstractConfigLoader\loadFile(), and Guzzle\Service\AbstractConfigLoader\mergeData().

Referenced by Guzzle\Service\AbstractConfigLoader\load(), and Guzzle\Service\AbstractConfigLoader\loadFile().

◆ removeAlias()

Guzzle\Service\AbstractConfigLoader::removeAlias (   $alias)

Remove an alias from the loader

Parameters
string$aliasAlias to remove
Returns
self

Definition at line 73 of file AbstractConfigLoader.php.

Field Documentation

◆ $aliases

array Guzzle\Service\AbstractConfigLoader::$aliases = array()
protected

Array of aliases for actual filenames

Definition at line 17 of file AbstractConfigLoader.php.

◆ $jsonErrors

Guzzle\Service\AbstractConfigLoader::$jsonErrors
staticprotected
Initial value:
= array(
JSON_ERROR_NONE => 'JSON_ERROR_NONE - No errors',
JSON_ERROR_DEPTH => 'JSON_ERROR_DEPTH - Maximum stack depth exceeded',
JSON_ERROR_STATE_MISMATCH => 'JSON_ERROR_STATE_MISMATCH - Underflow or the modes mismatch',
JSON_ERROR_CTRL_CHAR => 'JSON_ERROR_CTRL_CHAR - Unexpected control character found',
JSON_ERROR_SYNTAX => 'JSON_ERROR_SYNTAX - Syntax error, malformed JSON',
JSON_ERROR_UTF8 => 'JSON_ERROR_UTF8 - Malformed UTF-8 characters, possibly incorrectly encoded'
)

Definition at line 26 of file AbstractConfigLoader.php.

◆ $loadedFiles

array Guzzle\Service\AbstractConfigLoader::$loadedFiles = array()
protected

Hash of previously loaded filenames

Definition at line 23 of file AbstractConfigLoader.php.


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