1 | <?php |
||
34 | class Properties extends AbstractContainer |
||
35 | { |
||
36 | /** |
||
37 | * @var array The stored properties |
||
38 | */ |
||
39 | protected $values = []; |
||
40 | |||
41 | /** |
||
42 | * Creates a container with static configuration properties. |
||
43 | * |
||
44 | * Null values are silently ignored. |
||
45 | * |
||
46 | * ``` |
||
47 | * $props = new \Caridea\Container\Properties([ |
||
48 | * 'db.host' => 'example.com', |
||
49 | * 'db.port' => 1337, |
||
50 | * 'db.user' => 'dba', |
||
51 | * 'cache.holder' => new \SplObjectStorage(), |
||
52 | * 'dates.nye' => new \DateTime('2015-12-31') |
||
53 | * ]); |
||
54 | * ``` |
||
55 | * |
||
56 | * @param array<string,mixed> $properties String keys, mixed values. |
||
57 | * @param \Caridea\Container\Container $parent An optional parent container. |
||
58 | */ |
||
59 | 1 | public function __construct(array $properties, Container $parent = null) |
|
70 | |||
71 | /** |
||
72 | * More predictable results than `gettype`. |
||
73 | * |
||
74 | * @param mixed $v The value to evaluate |
||
75 | */ |
||
76 | 1 | protected static function typeof($v): string |
|
93 | |||
94 | /** |
||
95 | * Retrieves the value |
||
96 | * |
||
97 | * @param string $name The value name |
||
98 | */ |
||
99 | 1 | protected function doGet(string $name) |
|
103 | } |
||
104 |