\Orpheus\ConfigConfig

The config core class

This class is the core for config classes inherited from custom configuration.

Summary

Methods
Properties
Constants
asArray()
__get()
__set()
__isset()
add()
load()
checkSource()
build()
get()
set()
addRepository()
addRepositoryLibrary()
getFilePath()
parse()
isCaching()
setCaching()
No public properties found
No constants found
No protected methods found
$main
$caching
$config
$repositories
N/A
No private methods found
No private properties found
N/A

Properties

$main

$main : \Orpheus\Config\Config

Contains the main configuration, reachable from everywhere.

Type

\Orpheus\Config\Config

$caching

$caching : boolean

The config uses cache

Type

boolean

$config

$config : array

Contains the configuration for this Config Object.

Must be inherited from ConfigCore.

Type

array

$repositories

$repositories : array

The repositories

Type

array

Methods

asArray()

asArray() : array

Get this config as array

Returns

array

__get()

__get(  $key) : \Orpheus\Config\A

The magic function to get config

Parameters

$key

The key to get the value.

Returns

\Orpheus\Config\A —

config value.

Return the configuration item with key $key. Except for:

  • 'all' : It returns an array containing all configuration items.

__set()

__set(  $key,   $value) 

The magic function to set config

Parameters

$key

The key to set the value.

$value

The new config value.

Sets the configuration item with key $key. Except for:

  • 'all' : It sets all the array containing all configuration items.

__isset()

__isset(  $key) 

Magic isset

Parameters

$key

Key of the config to check is set

Checks if the config $key is set.

add()

add(  $conf) 

Add configuration to this object

Parameters

$conf

The configuration array to add to the current object.

Add the configuration array $conf to this configuration.

load()

load(  $source,   $cached = true) : boolean

Load new configuration from source

Parameters

$source

An identifier to get the source

$cached

True if this configuration should be cached

Returns

boolean —

True if this configuration was loaded successfully

Load a configuration from a source identified by $source.

checkSource()

checkSource(string  $source) : boolean

Check if source is available

Parameters

string $source

An identifier to get the source.

Returns

boolean —

True if source is available

build()

build(  $source,   $minor = false,   $cached = true) 

Build new configuration source

Parameters

$source

An identifier to build the source.

$minor

True if this is a minor configuration.

$cached

True if this configuration should be cached.

Build a configuration from $source using load() method. If it is not a minor configuration, that new configuration is added to the main configuration.

get()

get(  $key,   $default = null) : string

Get configuration from the main configuration object

Parameters

$key

The key to get the value.

$default

The default value to use.

Returns

string —

A config value.

Calls __get() method from main configuration object.

set()

set(  $key,   $value) 

Set configuration to the main configuration object

Parameters

$key

The key to set the value.

$value

The new config value.

Call __set() method to main configuration object.

addRepository()

addRepository(mixed  $repos) 

Add a repository to load configs

Parameters

mixed $repos

The repository to add. Commonly a path to a directory.

addRepositoryLibrary()

addRepositoryLibrary(string  $library) 

Add a repository library to load configs

Parameters

string $library

The library folder

getFilePath()

getFilePath(string  $source) : array

Get the file path

Parameters

string $source

An identifier to get the source.

Returns

array —

The configuration file path according to how Orpheus files are organized.

Get the configuration file path in CONFDIR.

parse()

parse(  $source) : \Orpheus\Config\The

Parse configuration from given source

Parameters

$source

An identifier or a path to get the source.

Returns

\Orpheus\Config\The —

loaded configuration array.

isCaching()

isCaching() : boolean

Test if config is caching

Returns

boolean

setCaching()

setCaching(boolean  $caching) 

Set if config is caching

Parameters

boolean $caching