1 | <?php |
||
12 | abstract class AbstractElementFactory implements ElementFactory |
||
13 | { |
||
14 | /** |
||
15 | * @var Container |
||
16 | */ |
||
17 | protected $app; |
||
18 | |||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | protected $parameters = []; |
||
23 | |||
24 | /** |
||
25 | * @inheritdoc |
||
26 | */ |
||
27 | 30 | public function __construct(Container $container) |
|
31 | |||
32 | /** |
||
33 | * @param string $class |
||
34 | * @return array |
||
35 | */ |
||
36 | 30 | protected function getElementConfig($class) |
|
40 | |||
41 | /** |
||
42 | * @param string $name |
||
43 | * @return mixed |
||
44 | */ |
||
45 | 12 | protected function getParameter($name) |
|
46 | { |
||
47 | 12 | if (array_key_exists($name, $this->parameters)) { |
|
48 | 12 | return $this->parameters[$name]; |
|
49 | } |
||
50 | |||
51 | return null; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @param string $name |
||
56 | * @param mixed $value |
||
57 | * @return $this |
||
58 | */ |
||
59 | 27 | protected function setParameter($name, $value) |
|
65 | |||
66 | /** |
||
67 | * @param string $name |
||
68 | * @return $this |
||
69 | */ |
||
70 | protected function unsetParameter($name) |
||
71 | { |
||
72 | unset($this->parameters[$name]); |
||
73 | |||
74 | return $this; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @param string $name |
||
79 | * @return bool |
||
80 | */ |
||
81 | protected function existsParameter($name) |
||
82 | { |
||
83 | return array_key_exists($name, $this->parameters); |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * @param array $parameters |
||
88 | * @return array |
||
89 | */ |
||
90 | 25 | protected function mergeParameters($parameters = []) |
|
94 | |||
95 | /** |
||
96 | * @inheritDoc |
||
97 | */ |
||
98 | 12 | function __get($name) |
|
102 | |||
103 | /** |
||
104 | * @inheritDoc |
||
105 | */ |
||
106 | 27 | function __set($name, $value) |
|
110 | |||
111 | /** |
||
112 | * @inheritDoc |
||
113 | */ |
||
114 | function __isset($name) |
||
118 | |||
119 | /** |
||
120 | * @inheritDoc |
||
121 | */ |
||
122 | function __unset($name) |
||
126 | } |