You've already forked php-flasher
mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-04-05 12:32:55 +01:00
35 lines
592 B
PHP
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;
|
|
}
|
|
}
|