Class Configure
Allows statically configured settings to be stored and accessed on a per-use
basis. The purpose of this class is to utilize globally set configurations from
a single location. Configurations can be set by default in /config/core.php, or
may be set at run time from anywhere within your application.
Final
Package: minPHP\
lib
Located at lib/configure.php
Methods summary
protected
|
#
__construct( )
Protected constructor to prevent instance creation
Protected constructor to prevent instance creation
|
public static
mixed
|
#
get( string $name )
Fetches a setting set using Configure::set()
Fetches a setting set using Configure::set()
Parameters
- $name
string $name The name of the setting to get
Returns
mixed The setting specified by $name, or null if $name was not set
|
public static
boolean
|
#
exists( string $name )
Checks if the setting exists
Checks if the setting exists
Parameters
- $name
string $name The name of the setting to check existance
Returns
boolean true if $name was set, false otherwise
|
public static
|
#
free( string $name )
Frees the setting given by $name, if it exists. All settings no longer in use
should be freed using this method whenever possible
Frees the setting given by $name, if it exists. All settings no longer in use
should be freed using this method whenever possible
Parameters
- $name
string $name The name of the setting to free
|
public static
|
#
set( string $name, mixed $value )
Adds the given $value to the configuration using the $name given
Adds the given $value to the configuration using the $name given
Parameters
- $name
string $name The name to give this setting. Use Configure::exists() to check for
pre-existing settings with the same name
- $value
mixed $value The value to set
|
public static
|
#
load( string $file, string $config_dir = CONFIGDIR )
Loads the given file and extracts all $config array elements, adding each to
Configure::$config
Loads the given file and extracts all $config array elements, adding each to
Configure::$config
Parameters
- $file
string $file The file name in CONFIGDIR to load (without extension)
- $config_dir
string $config_dir The directory from which to load the given config file, defaults to
CONFIGDIR
|
public static
|
#
errorReporting( integer $level )
Overwrites the existing error reporting level
Overwrites the existing error reporting level
Parameters
- $level
integer $level The Level of error reporting to set
|
Magic methods summary