nyroFwk  0.2
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()

__construct ( array  $prm = array())

Initialize the configuration variables

Parameters
array$prmInitial variables

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

Member Function Documentation

◆ __get()

__get (   $name)

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

Parameters
string$nameValue 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()

__isset (   $name)

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

Parameters
string$namevariable name to check
Returns
bool
See also
check

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

◆ __set()

__set (   $name,
  $val 
)

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

Parameters
string$nameName to set
mixed$valueValue to set
See also
set

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

◆ __toString()

__toString ( )
Returns
string Configuration in string to debug

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

◆ __unset()

__unset (   $name)

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

Parameters
string$nameVariable name to delete
See also
del

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

◆ check()

check (   $name)

check if a variable is set

Parameters
string$namevariable name to check
Returns
bool

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

◆ checkCfg()

checkCfg (   $throw = true)

Check if the configuration has all the required field

Parameters
bool$trowTrue to throw exception instead of only return false
Returns
bool True if good
Exceptions
nExceptionIf argument missing and parameter $throw set to true

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

◆ checkInArray()

checkInArray (   $name,
  $key 
)

check if a variable is set in an array

Parameters
string$namevariable name to check
string$keyKey on the array
Returns
bool

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

◆ del()

del (   $name)

Delete a variable

Parameters
string$nameVariable name to delete

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

◆ delInArray()

delInArray (   $name,
  $key 
)

Delete a variable to the config in an array

Parameters
string$nameVariable name
string$keyKey on the array

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

◆ get()

get (   $name)

Get a variable

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

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

◆ getAll()

getAll ( )

Get the whole configuration array

Returns
array

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

◆ getInArray()

getInArray (   $name,
  $key 
)

Get a variable inside an array

Parameters
string$nameVariable name
string$keyKey requested
Returns
mixed|null The value requested if exists or null

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

◆ getRef()

& getRef (   $name)

Get a variable by reference

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

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

◆ getVars()

& getVars ( )

Get all the actual configuration

Returns
array The configuration

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

◆ init()

init ( array  $prm)

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

Parameters
array$prmAll the variables needed for this config
Exceptions
nExecptionIf one required parameter isn't present

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

◆ initTab()

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$varsVariable array to initialize
array$initInit array
Returns
bool True if all required variables are present

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

◆ initTabNum()

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

Transform a numeric array to a string key array

Parameters
array$varsVariable array to transfer
array$varsNumNumeric Array to indicate the key
string$nameOtherName for value non indicate in the $varsNum array, if needed
bool$rtlTrue to init Right to Left or false to init Left to Right

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

◆ overInit()

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$prmAll the variables to add

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

◆ overload()

overload (   $className,
  $parent = false 
)

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

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

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

◆ set()

set (   $name,
  $val 
)

Set a variable to the config

Parameters
string$nameVariable name
mixed$valValue
See also
setA,setRef,setARef

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

◆ setA()

setA ( array  $vars)

Set an array of variable to the config

Parameters
array$varsVariables to set
See also
set

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

◆ setARef()

setARef ( array  $vars)

Set an array of variable to the config by reference

Parameters
array$varsVariables to set
See also
setRef

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

◆ setInArray()

setInArray (   $name,
  $key,
  $val 
)

Set a variable to the config in an array

Parameters
string$nameVariable name
string$keyKey on the array
mixed$valValue
See also
setA,setRef,setARef

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

◆ setInArrayA()

setInArrayA (   $name,
array  $values 
)

Set variables to the config in an array

Parameters
string$nameVariable name
array$valuesthe Values
See also
setInArray

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

◆ setRef()

setRef (   $name,
$val 
)

Set a variable to the config by reference

Parameters
string$nameVariable name
mixed$valValue
See also
setARef,set,setA

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

Field Documentation

◆ $vars

$vars
private

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

◆ REQUIRED

const REQUIRED = 'REQUIRED'

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


The documentation for this class was generated from the following file:
Generated on Sun Oct 15 2017 22:25:20 for nyroFwk by doxygen 1.8.13