Abstract Class Guzzle\Service\AbstractConfigLoader

InheritanceGuzzle\Service\AbstractConfigLoader
ImplementsGuzzle\Service\ConfigLoaderInterface
SubclassesGuzzle\Service\Builder\ServiceBuilderLoader, Guzzle\Service\Description\ServiceDescriptionLoader

Abstract config loader

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$aliases array Array of aliases for actual filenames Guzzle\Service\AbstractConfigLoader
$jsonErrors array JSON error code mappings Guzzle\Service\AbstractConfigLoader
$loadedFiles array Hash of previously loaded filenames Guzzle\Service\AbstractConfigLoader

Public Methods

Hide inherited methods

MethodDescriptionDefined By
addAlias() Add an include alias to the loader Guzzle\Service\AbstractConfigLoader
load() Guzzle\Service\AbstractConfigLoader
removeAlias() Remove an alias from the loader Guzzle\Service\AbstractConfigLoader

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
build() Perform the parsing of a config file and create the end result Guzzle\Service\AbstractConfigLoader
loadFile() Load a configuration file (can load JSON or PHP files that return an array when included) Guzzle\Service\AbstractConfigLoader
mergeData() Default implementation for merging two arrays of data (uses array_merge_recursive) Guzzle\Service\AbstractConfigLoader
mergeIncludes() Merges in all include files Guzzle\Service\AbstractConfigLoader

Property Details

$aliases protected property

Array of aliases for actual filenames

protected array $aliases = []
$jsonErrors protected static property

JSON error code mappings

protected static array $jsonErrors = [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']
$loadedFiles protected property

Hash of previously loaded filenames

protected array $loadedFiles = []

Method Details

addAlias() public method

Add an include alias to the loader

public self addAlias ( $filename, $alias )
$filename string

Filename to alias (e.g. _foo)

$alias string

Actual file to use (e.g. /path/to/foo.json)

build() protected abstract method

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

protected abstract mixed build ( $config, array $options )
$config array

Configuration data

$options array

Options to use when building

load() public method

public void load ( $config, array $options = [] )
$config
$options
loadFile() protected method

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

protected array loadFile ( $filename )
$filename string

File to load

throws Guzzle\Common\Exception\InvalidArgumentException
throws Guzzle\Common\Exception\RuntimeException

when the JSON cannot be parsed

mergeData() protected method

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

protected array mergeData ( array $a, array $b )
$a array

Original data

$b array

Data to merge into the original and overwrite existing values

mergeIncludes() protected method

Merges in all include files

protected array mergeIncludes ( &$config, $basePath null )
$config array

Config data that contains includes

$basePath string

Base path to use when a relative path is encountered

return array

Returns the merged and included data

removeAlias() public method

Remove an alias from the loader

public self removeAlias ( $alias )
$alias string

Alias to remove