Convert defined security levels into defined constants prefixed with SECURITY_LEVEL_*. Also documented the flatten method.
This commit is contained in:
parent
376d3226cc
commit
03567d86d4
1 changed files with 28 additions and 0 deletions
|
@ -137,12 +137,40 @@ class Config extends Object
|
|||
$this->data['pickles']['profiler'] = false;
|
||||
}
|
||||
|
||||
// Creates constants for the security levels
|
||||
if (isset($this->data['security']['levels']) && is_array($this->data['security']['levels']))
|
||||
{
|
||||
foreach ($this->data['security']['levels'] as $value => $name)
|
||||
{
|
||||
$constant = 'SECURITY_LEVEL_' . strtoupper($name);
|
||||
|
||||
// Checks if constant is already defined, and throws an error
|
||||
if (defined($constant))
|
||||
{
|
||||
throw new Exception('The constant ' . $constant . ' is already defined');
|
||||
}
|
||||
else
|
||||
{
|
||||
define($constant, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flatten
|
||||
*
|
||||
* Flattens the configuration array around the specified environment.
|
||||
*
|
||||
* @param string $environment selected environment
|
||||
* @param array $array configuration error to flatten
|
||||
* @return array flattened configuration array
|
||||
*/
|
||||
private function flatten($environment, $array)
|
||||
{
|
||||
if (is_array($array))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue