Orpheus

IniConfig extends Config
in package

The ini config class

This class uses ini files to get configuration.

Table of Contents

Properties

$caching  : bool
The config uses cache
$config  : array<string|int, mixed>
Contains the configuration for this Config Object.
$extension  : string
Extension for this config files
$main  : Config|null
Contains the main configuration, reachable from everywhere
$repositories  : array<string|int, mixed>
The repositories

Methods

__get()  : array<string|int, mixed>
Return the configuration item with key $key.
__isset()  : mixed
Checks if the config $key is set.
__set()  : mixed
Sets the configuration item with key $key.
add()  : void
Add configuration to this object
asArray()  : array<string|int, mixed>
Get this config as array
build()  : Config|null
Build a configuration from $source using load() method.
buildFrom()  : Config|null
Build new configuration source from package
count()  : int
get()  : mixed
Get configuration from the main configuration object
getArray()  : array<string|int, mixed>
getFilePath()  : string|null
Get the file path Get the configuration file path in CONFIG_FOLDER.
getIterator()  : Traversable
getMain()  : Config|null
getOne()  : mixed
Get one config value
hasSource()  : bool
Check if source is available
isCaching()  : bool
Test if config is caching
load()  : bool
Load new configuration from source
loadFrom()  : bool
Load new configuration from source in package
offsetExists()  : bool
offsetGet()  : mixed
offsetSet()  : void
offsetUnset()  : void
parse()  : mixed
Parse configuration from given source.
set()  : void
Set configuration to the main configuration object Call __set() method to main configuration object.
setCaching()  : void
Set if config is caching
getSourcePath()  : string
normalizeName()  : string

Properties

$caching

The config uses cache

protected static bool $caching = true

$config

Contains the configuration for this Config Object.

protected array<string|int, mixed> $config = []

Must be inherited from ConfigCore.

$extension

Extension for this config files

protected static string $extension = 'ini'

$main

Contains the main configuration, reachable from everywhere

protected static Config|null $main = null

$repositories

The repositories

protected static array<string|int, mixed> $repositories = []

Methods

__get()

Return the configuration item with key $key.

public __get(string $key) : array<string|int, mixed>

Except for:

  • 'all' : It returns an array containing all configuration items.
Parameters
$key : string

The key to get the value

Return values
array<string|int, mixed>

A config value

__isset()

Checks if the config $key is set.

public __isset(string $key) : mixed
Parameters
$key : string

Key of the config to check is set

__set()

Sets the configuration item with key $key.

public __set(string $key, mixed $value) : mixed

Except for:

  • 'all' : It sets all the array containing all configuration items.
Parameters
$key : string

The key to set the value

$value : mixed

The new config value

add()

Add configuration to this object

public add(array<string|int, mixed>|null $config) : void
Parameters
$config : array<string|int, mixed>|null

The configuration array to add to the current object.

asArray()

Get this config as array

public asArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

build()

Build a configuration from $source using load() method.

public static build(string $source[, bool $minor = false ][, bool $cached = true ]) : Config|null

If it is not a minor configuration, that new configuration is added to the main configuration.

Parameters
$source : string

An identifier to build the source

$minor : bool = false

True if this is a minor configuration

$cached : bool = true

True if this configuration should be cached

Return values
Config|null

buildFrom()

Build new configuration source from package

public static buildFrom(string|null $package, string $source[, bool $cached = true ][, bool $silent = false ]) : Config|null

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

Parameters
$package : string|null

The package to include config (null to get app config)

$source : string

An identifier to build the source

$cached : bool = true

True if this configuration should be cached

$silent : bool = false

True if ignoring config loading issues

Return values
Config|null

get()

Get configuration from the main configuration object

public static get(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string

The key to get the value

$default : mixed = null

The default value to use

Return values
mixed

A config value

getArray()

public abstract & getArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFilePath()

Get the file path Get the configuration file path in CONFIG_FOLDER.

public static getFilePath(string $source[, string|null $package = null ]) : string|null
Parameters
$source : string

An identifier to get the source.

$package : string|null = null

The package to get file path (null to get app file path). Default is null

Return values
string|null

The configuration file path, this file exists or an exception is thrown.

getIterator()

public getIterator() : Traversable
Return values
Traversable

getOne()

Get one config value

public getOne(string $key[, mixed $default = null ]) : mixed
Parameters
$key : string
$default : mixed = null

hasSource()

Check if source is available

public hasSource(string $source[, string|null $package = null ]) : bool
Parameters
$source : string

An identifier to get the source

$package : string|null = null
Return values
bool

True if source is available

isCaching()

Test if config is caching

public static isCaching() : bool
Return values
bool

load()

Load new configuration from source

public load(string $source[, bool $cached = true ]) : bool
Parameters
$source : string

An identifier to get the source

$cached : bool = true

True if this configuration should be cached

Return values
bool

True if this configuration was loaded successfully

loadFrom()

Load new configuration from source in package

public loadFrom(string|null $package, string $source[, bool $cached = true ]) : bool
Parameters
$package : string|null

The package to include config (null to get app config)

$source : string

An identifier to get the source

$cached : bool = true

True if this configuration should be cached

Return values
bool

True if this configuration was loaded successfully

offsetExists()

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

offsetGet()

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed

offsetSet()

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed

offsetUnset()

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed

parse()

Parse configuration from given source.

public static parse(string $path) : mixed

If an identifier, loads a configuration from a .ini file in CONFIG_FOLDER. Else $source is a full path to the ini configuration file.

Parameters
$path : string

The path to the config file

Return values
mixed

The loaded configuration array

set()

Set configuration to the main configuration object Call __set() method to main configuration object.

public static set(string $key, mixed $value) : void
Parameters
$key : string

The key to set the value

$value : mixed

The new config value

Tags
throws
Exception

setCaching()

Set if config is caching

public static setCaching(bool $caching) : void
Parameters
$caching : bool

getSourcePath()

protected static getSourcePath(string $source) : string
Parameters
$source : string
Return values
string

normalizeName()

protected normalizeName(string $name) : string
Parameters
$name : string
Return values
string

							
On this page

Search results