/
Wild_RNB
/
ASU
Обзор
Документация
Войти
/
Wild_RNB
/
ASU
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
src/Config/KernelConfig.php
39 строк
763 B
am190620045-afk
feat(kernel): add kernel configuration access layer
19 июл 2026, 21:13
19 июл 2026, 21:13
71b934c
Код
Авторство
О чём код?
<?php declare(strict_types=1); namespace ASU\Config; final class KernelConfig { private array $config; public function __construct(?string $path = null) { $loader = new Loader(); $this->config = $loader->load( $path ?? dirname(__DIR__, 2) . '/config/kernel.php' ); } public function get(string $key, mixed $default = null): mixed { $value = $this->config; foreach (explode('.', $key) as $segment) { if (!is_array($value) || !array_key_exists($segment, $value)) { return $default; } $value = $value[$segment]; } return $value; } public function all(): array { return $this->config; } }