1 | <?php |
||
24 | final class ContainerBuilder |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * For easy getters and setters |
||
29 | */ |
||
30 | use BaseMethods; |
||
31 | |||
32 | /** |
||
33 | * @read |
||
34 | * @var array |
||
35 | */ |
||
36 | protected $definitions = []; |
||
37 | |||
38 | /** |
||
39 | * @read |
||
40 | * @var bool |
||
41 | */ |
||
42 | protected $override = false; |
||
43 | |||
44 | /** |
||
45 | * @read |
||
46 | * @var Container |
||
47 | */ |
||
48 | protected $container; |
||
49 | |||
50 | /** |
||
51 | * Creates a container builder with provided definitions and override mode |
||
52 | * |
||
53 | * @param array|string $definitions |
||
54 | * The definitions list for container creation |
||
55 | * @param bool $override |
||
56 | * Set to true to override existing definitions |
||
57 | */ |
||
58 | 8 | public function __construct($definitions, $override = false) |
|
63 | |||
64 | /** |
||
65 | * Creates a container with existing definitions |
||
66 | * |
||
67 | * @return Container |
||
68 | */ |
||
69 | 6 | public function getContainer() |
|
77 | |||
78 | /** |
||
79 | * Apply definitions to content |
||
80 | */ |
||
81 | 6 | private function applyDefinitions() |
|
96 | |||
97 | /** |
||
98 | * Checks the data to be returned |
||
99 | * |
||
100 | * @param string|array $definitions |
||
101 | * @return array |
||
102 | */ |
||
103 | 8 | private function checkDefinitions($definitions) |
|
119 | } |
||
120 |