Class constant
Legacy configuration driver that retrieves values from constants. It provides support for Core 3.1 configurations but should not be used for new projects.
=== Implementation Configuration keys are mapped to constants by taking the first key segment (the section) as the base namespace name with a fixed sub-namespace called "Configuration", followed by additional optional sub-namespaces with the same name as additional segments. Each segment name is converted to camel-case.
Per default, PHP constants are case-sensitive, unless they were defined explicitly to be case-insensitive. If constants are being used that do not fully translate to camel-case, the constant matching can be set to be case-insensitive by searching through all user-defined variables, with an accordingly increased overhead. A case-insensitive match is only performed if no case-sensitive match was found.
Requests for collections should be avoided, as those require an expensive
search through all defined user-constants. Additionally, PHP stores all
namespaces in lowercase only, hence camel-case namespaces cannot be converted
to their proper option name. Use an underscore ("_"
) in the affected
namespace name instead.
As additional constants are easily registered but existing constants cannot be changed, the system configuration is not buffered.
=== Restrictions As constants cannot be overridden in PHP, setting values is unsupported.
- Core\Object implements Core\Chainable
- Core\Set implements Core\Accessor
- Core\Set\Mutable implements Core\Mutator
- Core\Field implements Core\Inquiry
- Core\Field\Mutable implements Core\Variator
- Core\Configuration
- Core\Configuration\Driver\constant
Package: Core\Configuration\Driver
Since: 3.2
Requires: PHP 5.3
Version: 1.0
Located at Configuration/Driver/constant.inc.php
Methods summary
public
|
|
protected
mixed
|
|
public
array
|
#
getArray( string $key, mixed $default = null )
Retrieves a configuration option as an array. If the option is the default value given are not an array, the value is converted into an array. |
Methods inherited from Core\Configuration
autocreate()
,
decodeClassName()
,
get()
,
getDataForUndefinedKey()
,
getValue()
Methods inherited from Core\Field\Mutable
offsetSet()
,
offsetUnset()
,
setDataForKey()
,
setDataForKeys()
,
setDataForUndefinedKey()
,
setKeyMasquerade()
,
updateMasqueradedKeys()
Methods inherited from Core\Field
getDataForKey()
,
getDataForKeys()
,
issetDataForKey()
,
offsetExists()
,
offsetGet()
Methods inherited from Core\Set\Mutable
Methods inherited from Core\Object
__autocreateFactory()
,
__call()
,
__processParameters()
,
__toString()
,
attachMethod()
,
chain()
,
getValueForKey()
,
getValueForKeyPath()
,
getValueForUndefinedKey()
,
hash()
,
issetValueForKey()
,
setValueForKey()
,
setValueForKeyPath()
,
setValueForUndefinedKey()
,
uuid()
Constants summary
string |
CaseInsensitiveParameter
Boolean configuration parameter. If enabled, constants are resolved case-independent. This can solve problems with mixed case names. |
#
'case-insensitive'
|
Constants inherited from Core\Object
AnyParameterType
,
AutochainParameterType
,
AutocreateParameterType
,
BooleanParameterType
,
CharParameterType
,
EnumParameterType
,
IntegerParameterType
,
RealParameterType
,
StringParameterType
,
UserParameterType