Public Member Functions | Static Public Member Functions | Data Fields | Private Attributes

config Class Reference

Public Member Functions

 __construct (array $prm=array())
 __toString ()
 checkCfg ($throw=true)
 init (array $prm)
 overInit (array $prm)
 overload ($className, $parent=false)
getVars ()
 get ($name)
 getInArray ($name, $key)
 __get ($name)
getRef ($name)
 getAll ()
 setA (array $vars)
 setARef (array $vars)
 set ($name, $val)
 setInArray ($name, $key, $val)
 setInArrayA ($name, array $values)
 setRef ($name, &$val)
 __set ($name, $val)
 check ($name)
 checkInArray ($name, $key)
 __isset ($name)
 del ($name)
 delInArray ($name, $key)
 __unset ($name)

Static Public Member Functions

static initTab (array &$vars, array $init)
static initTabNum (array &$vars, array $varsNum, $nameOther='other', $rtl=true)

Data Fields

const REQUIRED = 'REQUIRED'

Private Attributes

 $vars

Detailed Description

Configuration for all the class

Definition at line 10 of file config.class.php.


Constructor & Destructor Documentation

__construct ( array $  prm = array()  ) 

Initialize the configuration variables

Parameters:
array $prm Initial variables

Definition at line 26 of file config.class.php.


Member Function Documentation

__get ( name  ) 

Get a configuration variable, with a convenient way $config->name

Parameters:
string $name Value requested
Returns:
mixed The value requested, null if it doesn't exists
See also:
get

Definition at line 163 of file config.class.php.

__isset ( name  ) 

Check if a variable is set, with a convenient way isset($config->name)

Parameters:
string $name variable name to check
Returns:
bool
See also:
check

Definition at line 298 of file config.class.php.

__set ( name,
val 
)

Set a variable, with a convenient way $config->name = $value

Parameters:
string $name Name to set
mixed $value Value to set
See also:
set

Definition at line 266 of file config.class.php.

__toString (  ) 
Returns:
string Configuration in string to debug

Definition at line 33 of file config.class.php.

__unset ( name  ) 

Delete a variable, with a convenient way unset($config->name)

Parameters:
string $name Variable name to delete
See also:
del

Definition at line 329 of file config.class.php.

check ( name  ) 

check if a variable is set

Parameters:
string $name variable name to check
Returns:
bool

Definition at line 276 of file config.class.php.

checkCfg ( throw = true  ) 

Check if the configuration has all the required field

Parameters:
bool $trow True to throw exception instead of only return false
Returns:
bool True if good
Exceptions:
nException If argument missing and parameter $throw set to true

Definition at line 44 of file config.class.php.

checkInArray ( name,
key 
)

check if a variable is set in an array

Parameters:
string $name variable name to check
string $key Key on the array
Returns:
bool

Definition at line 287 of file config.class.php.

del ( name  ) 

Delete a variable

Parameters:
string $name Variable name to delete

Definition at line 307 of file config.class.php.

delInArray ( name,
key 
)

Delete a variable to the config in an array

Parameters:
string $name Variable name
string $key Key on the array

Definition at line 318 of file config.class.php.

get ( name  ) 

Get a variable

Parameters:
string $name Variable name
Returns:
mixed|null The value requested if exists or null
See also:
getRef

Definition at line 136 of file config.class.php.

getAll (  ) 

Get the whole configuration array

Returns:
array

Definition at line 188 of file config.class.php.

getInArray ( name,
key 
)

Get a variable inside an array

Parameters:
string $name Variable name
string $key Key requested
Returns:
mixed|null The value requested if exists or null

Definition at line 150 of file config.class.php.

& getRef ( name  ) 

Get a variable by reference

Parameters:
string $name Variable name
Returns:
mixed The value requested if exists or null
See also:
get

Definition at line 174 of file config.class.php.

& getVars (  ) 

Get all the actual configuration

Returns:
array The configuration

Definition at line 125 of file config.class.php.

init ( array $  prm  ) 

Create and verify all the variables needed for this config. A required variable is indicate by a value null

Parameters:
array $prm All the variables needed for this config
Exceptions:
nExecption If one required parameter isn't present

Definition at line 70 of file config.class.php.

static initTab ( array &$  vars,
array $  init 
) [static]

Initialize an array with an init array. Return a boolean to indicate if all required variable are present. A required variable is indicate by a value null

Parameters:
array $vars Variable array to initialize
array $init Init array
Returns:
bool True if all required variables are present

Definition at line 342 of file config.class.php.

static initTabNum ( array &$  vars,
array $  varsNum,
nameOther = 'other',
rtl = true 
) [static]

Transform a numeric array to a string key array

Parameters:
array $vars Variable array to transfer
array $varsNum Numeric Array to indicate the key
string $nameOther Name for value non indicate in the $varsNum array, if needed
bool $rtl True to init Right to Left or false to init Left to Right

Definition at line 362 of file config.class.php.

overInit ( array $  prm  ) 

Add to the actual config by merge (array) or create an array with the initial variable followed by the adding elements

Parameters:
array $prm All the variables to add

Definition at line 91 of file config.class.php.

overload ( className,
parent = false 
)

Overload a config from an other class. The class could not exists

Parameters:
string $className
bool $parent Indicate if the search should load the parent config (if virtual, should be false!)

Definition at line 116 of file config.class.php.

set ( name,
val 
)

Set a variable to the config

Parameters:
string $name Variable name
mixed $val Value
See also:
setA,setRef,setARef

Definition at line 221 of file config.class.php.

setA ( array $  vars  ) 

Set an array of variable to the config

Parameters:
array $vars Variables to set
See also:
set

Definition at line 198 of file config.class.php.

setARef ( array $  vars  ) 

Set an array of variable to the config by reference

Parameters:
array $vars Variables to set
See also:
setRef

Definition at line 209 of file config.class.php.

setInArray ( name,
key,
val 
)

Set a variable to the config in an array

Parameters:
string $name Variable name
string $key Key on the array
mixed $val Value
See also:
setA,setRef,setARef

Definition at line 233 of file config.class.php.

setInArrayA ( name,
array $  values 
)

Set variables to the config in an array

Parameters:
string $name Variable name
array $values the Values
See also:
setInArray

Definition at line 244 of file config.class.php.

setRef ( name,
&$  val 
)

Set a variable to the config by reference

Parameters:
string $name Variable name
mixed $val Value
See also:
setARef,set,setA

Definition at line 255 of file config.class.php.


Field Documentation

$vars [private]

Definition at line 19 of file config.class.php.

const REQUIRED = 'REQUIRED'

Definition at line 12 of file config.class.php.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations
Generated on Thu Jan 26 2012 18:40:07 for nyroFwk by doxygen 1.7.1