@@ 455-467 (lines=13) @@ | ||
452 | * @param mixed $default Value to default to, path key not found. |
|
453 | * @return mixed |
|
454 | */ |
|
455 | protected function getFromArray($array, $path, $default = null) |
|
456 | { |
|
457 | $search_in = $array; |
|
458 | $path = explode('.', $path); |
|
459 | foreach ($path as $key) { |
|
460 | if (!isset($search_in[$key])) { |
|
461 | return $default; |
|
462 | } |
|
463 | $search_in = $search_in[$key]; |
|
464 | } |
|
465 | ||
466 | return $search_in; |
|
467 | } |
|
468 | } |
|
469 |
@@ 228-240 (lines=13) @@ | ||
225 | /** |
|
226 | * @param string $yaml_path string with point for levels |
|
227 | */ |
|
228 | protected function getFromYaml($yaml_path, $default = null) |
|
229 | { |
|
230 | $search_in = $this->yaml; |
|
231 | $yaml_path = explode('.', $yaml_path); |
|
232 | foreach ($yaml_path as $key) { |
|
233 | if (!isset($search_in[$key])) { |
|
234 | return $default; |
|
235 | } |
|
236 | $search_in = $search_in[$key]; |
|
237 | } |
|
238 | ||
239 | return $search_in; |
|
240 | } |
|
241 | } |
|
242 |