PHP Class Pop\Config

Author: Nick Sagona, III ([email protected])
Show file Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Property Type Description
$allowChanges boolean Flag for whether or not changes are allowed after object instantiation
$array array Config values as an array
$config array Config values as config objects

Public Methods

Method Description
__construct ( array $config = [], boolean $changes = false ) : Config Constructor
__get ( string $name ) : mixed Magic get method to return the value of config[$name].
__isset ( string $name ) : boolean Return the isset value of config[$name].
__set ( string $name, mixed $value ) : void Set method to set the property to the value of config[$name].
__unset ( string $name ) : void Unset config[$name].
asArray ( ) : array Method to get the config values as an array
asArrayObject ( ) : array Method to get the config values as an ArrayObject
changesAllowed ( ) : boolean Method to return if changes to the config are allowed.
factory ( array $config = [], boolean $changes = false ) : Config Static method to instantiate the config object and return itself to facilitate chaining methods together.
get ( string $name ) : mixed Get method to return the value of config[$name].
merge ( mixed $config ) : Config Method to merge the values of another config object into this one

Protected Methods

Method Description
getConfig ( ) : void Method to get the config values as array
getConfigObject ( ) : void Method to get the config values as ArrayObject
setConfig ( array $config ) : void Method to set the config values

Method Details

__construct() public method

Instantiate a config object
public __construct ( array $config = [], boolean $changes = false ) : Config
$config array
$changes boolean
return Config

__get() public method

Magic get method to return the value of config[$name].
public __get ( string $name ) : mixed
$name string
return mixed

__isset() public method

Return the isset value of config[$name].
public __isset ( string $name ) : boolean
$name string
return boolean

__set() public method

Set method to set the property to the value of config[$name].
public __set ( string $name, mixed $value ) : void
$name string
$value mixed
return void

__unset() public method

Unset config[$name].
public __unset ( string $name ) : void
$name string
return void

asArray() public method

Method to get the config values as an array
public asArray ( ) : array
return array

asArrayObject() public method

Method to get the config values as an ArrayObject
public asArrayObject ( ) : array
return array

changesAllowed() public method

Method to return if changes to the config are allowed.
public changesAllowed ( ) : boolean
return boolean

factory() public static method

Static method to instantiate the config object and return itself to facilitate chaining methods together.
public static factory ( array $config = [], boolean $changes = false ) : Config
$config array
$changes boolean
return Config

get() public method

Get method to return the value of config[$name].
public get ( string $name ) : mixed
$name string
return mixed

getConfig() protected method

Method to get the config values as array
protected getConfig ( ) : void
return void

getConfigObject() protected method

Method to get the config values as ArrayObject
protected getConfigObject ( ) : void
return void

merge() public method

Method to merge the values of another config object into this one
public merge ( mixed $config ) : Config
$config mixed
return Config

setConfig() protected method

Method to set the config values
protected setConfig ( array $config ) : void
$config array
return void

Property Details

$allowChanges protected property

Flag for whether or not changes are allowed after object instantiation
protected bool $allowChanges
return boolean

$array protected property

Config values as an array
protected array $array
return array

$config protected property

Config values as config objects
protected array $config
return array