Files
php-flasher/Config/Config.php
T
2020-12-02 00:57:12 +01:00

35 lines
592 B
PHP

<?php
namespace Flasher\Prime\Config;
final class Config implements ConfigInterface
{
/**
* @var array<string, mixed>
*/
private $config;
public function __construct(array $config)
{
$this->config = $config;
}
/**
* @inheritDoc
*/
public function get($key, $default = null)
{
$data = $this->config;
foreach (explode('.', $key) as $segment) {
if (!isset($data[$segment])) {
return $default;
}
$data = $data[$segment];
}
return $data;
}
}