protected __default ( string $ctx, mixed $default ) : array | ||
$ctx | string | A string representing the key of the configuration array to return. |
$default | mixed | The default value to return if the key wasn't found. |
return | array | First element: either the value of the configuration array's requested key or the default value if the key wasn't found. Second element: whether the returned value was the default value. |
protected function __default($ctx, $default)
{
$ctx = explode('|', $ctx);
$ptr = $this->_currentConfig;
for ($i = 0, $ctx_count = count($ctx); $i < $ctx_count; ++$i) {
if (!isset($ptr[$ctx[$i]])) {
return array($default, true);
}
$ptr = $ptr[$ctx[$i]];
}
return array($ptr, false);
}