waConfig

Management of the framework's dynamic configuration

Contents...

Methods

  • add

    Adds an array of parameters to the current configuration.

  • clear

    Removes all configuration parametersконфигурации.

  • get

    Returns the value of a configuration parameter.

  • getAll

    Returns the values of all configuration parameters.

  • has

    Verifies whether a value is set for the specified conifiguration parameter.

  • set

    Sets a value for the specified configuration parameter.

public static function add ($parameters = array())

Adds an array of parameters to the current configuration.

Parameters

  • $parameters

    Associative array of parameters.

Example

$params = array(
    'key1' => 'value1',
    'key2' => 'value2',
);
waConfig::add($params);

public static function clear()

Removes all configuration parametersконфигурации.

Example

waConfig::clear()

public static function get ($name, $default = null)

Returns the value of a configuration parameter.

Parameters

  • $name

    Parameter id (string).

  • $default

    The default which must be returned if a configuration parameter with the specified id is not available.

Example

waConfig::get('domain', 'localhost')

public static function getAll()

Returns the values of all configuration parameters.

Example

waConfig::getAll()

Result

Array
(
    [wa_path_root] => /var/www
    [wa_path_apps] => /var/www/wa-apps
    [wa_path_system] => /var/www/wa-system
    [wa_path_log] => /var/www/wa-log
    [wa_path_data] => /var/www/wa-data
    [wa_path_config] => /var/www/wa-config
    [wa_path_cache] => /var/www/wa-cache
    [wa_path_plugins] => /var/www/wa-plugins
    [wa_path_installer] => /var/www/wa-installer
)

public static function has ($name)

Verifies whether a value is set for the specified conifiguration parameter.

Parameters

  • $name

    Configuration parameter id.

Example

waConfig::has('domain')

Result

false //parameter with id 'domain' is not available

public static function set ($name, $value)

Sets a value for the specified configuration parameter.

Parameters

  • $name

    Configuration parameter id.

  • $value

    Parameter value.

Example

waConfig::set('domain', 'localhost')