25 #require_once 'Zend/Config.php'; 70 self::$_ignoreConstants = (bool) $flag;
101 if (!is_callable($yamlDecoder)) {
102 #require_once 'Zend/Config/Exception.php'; 106 $this->_yamlDecoder = $yamlDecoder;
134 #require_once 'Zend/Config/Exception.php'; 139 $allowModifications =
false;
144 switch (strtolower($key)) {
145 case 'allow_modifications':
146 case 'allowmodifications':
147 $allowModifications = (bool)
$value;
151 $this->_skipExtends = (bool)
$value;
153 case 'ignore_constants':
154 case 'ignoreconstants':
155 $ignoreConstants = (bool)
$value;
168 set_error_handler(array($this,
'_loadFileErrorHandler'));
170 restore_error_handler();
173 if ($this->_loadFileErrorStr !==
null) {
174 #require_once 'Zend/Config/Exception.php'; 189 #require_once 'Zend/Config/Exception.php'; 193 if (
null === $section) {
194 $dataArray = array();
195 foreach (
$config as $sectionName => $sectionData) {
198 parent::__construct($dataArray, $allowModifications);
199 }
elseif (is_array($section)) {
200 $dataArray = array();
201 foreach ($section as $sectionName) {
202 if (!isset(
$config[$sectionName])) {
203 #require_once 'Zend/Config/Exception.php'; 205 'Section "%s" cannot be found',
206 implode(
' ', (array)$section)
212 parent::__construct($dataArray, $allowModifications);
214 if (!isset(
$config[$section])) {
215 #require_once 'Zend/Config/Exception.php'; 217 'Section "%s" cannot be found',
218 implode(
' ', (array)$section)
223 if (!is_array($dataArray)) {
225 $dataArray = array($section => $dataArray);
227 parent::__construct($dataArray, $allowModifications);
230 $this->_loadedSection = $section;
245 if (!isset(
$data[$section])) {
246 #require_once 'Zend/Config/Exception.php'; 250 $thisSection =
$data[$section];
252 if (is_array($thisSection) && isset($thisSection[self::EXTENDS_NAME])) {
255 if (!$this->_skipExtends) {
258 unset($thisSection[self::EXTENDS_NAME]);
276 $lines = explode(
"\n", $yaml);
292 foreach ($line as $n => $line) {
295 $line = rtrim(preg_replace(
"/#.*$/",
"", $line));
296 if (strlen($line) == 0) {
300 $indent = strspn($line,
" ");
304 if (strlen($line) == 0) {
308 if ($indent < $currentIndent) {
315 $currentIndent = $indent;
319 if (preg_match(
"/(?!-)([\w\-]+):\s*(.*)/", $line, $m)) {
323 $value = preg_replace(
"/#.*$/",
"", $m[2]);
333 }
elseif ($line[0] ==
"-") {
336 if (strlen($line) > 2) {
337 $value = substr($line, 2);
344 #require_once 'Zend/Config/Exception.php'; 346 'Error parsing YAML at line %d - unsupported syntax: "%s"',
365 if (
'"' == substr(
$value, 0, 1)) {
366 if (
'"' == substr(
$value, -1)) {
374 if (preg_match(
'/^(t(rue)?|on|y(es)?)$/i',
$value)) {
376 }
elseif (preg_match(
'/^(f(alse)?|off|n(o)?)$/i',
$value)) {
380 }
elseif (!self::$_ignoreConstants) {
396 foreach (self::_getConstants() as $constant) {
397 if (strstr(
$value, $constant)) {
398 $value = str_replace($constant, constant($constant),
$value);
411 $constants = array_keys(get_defined_constants());
412 rsort($constants, SORT_STRING);
__construct($yaml, $section=null, $options=false)
setYamlDecoder($yamlDecoder)
static _decodeYaml($currentIndent, &$lines)
elseif(isset( $params[ 'redirect_parent']))
call_user_func($callable, $param)
static _replaceConstants($value)
_processExtends(array $data, $section, array $config=array())
static _parseValue($value)
static setIgnoreConstants($flag)
_assertValidExtend($extendingSection, $extendedSection)
_arrayMergeRecursive($firstArray, $secondArray)