1 | <?php |
||
33 | class Jarvis extends Container implements BroadcasterInterface |
||
34 | { |
||
35 | use BroadcasterTrait { |
||
36 | broadcast as traitBroadcast; |
||
37 | } |
||
38 | |||
39 | const DEFAULT_DEBUG = false; |
||
40 | const CONTAINER_PROVIDER_FQCN = ContainerProvider::class; |
||
41 | |||
42 | private $masterSetter = false; |
||
43 | |||
44 | /** |
||
45 | * Creates an instance of Jarvis. It can take settings as first argument. |
||
46 | * List of accepted options: |
||
47 | * - providers (type: string|array): fqcn of your container provider |
||
48 | * - extra |
||
49 | * |
||
50 | * @param array $settings Your own settings to modify Jarvis behavior |
||
51 | */ |
||
52 | public function __construct(array $settings = []) |
||
62 | |||
63 | public function __destruct() |
||
67 | |||
68 | /** |
||
69 | * This method is an another way to get a locked value. |
||
70 | * |
||
71 | * Example: $this['foo'] is equal to $this->foo, but it ONLY works for locked values. |
||
72 | * |
||
73 | * @param string $key The key of the locked value |
||
74 | * @return mixed |
||
75 | * @throws \InvalidArgumentException if the requested key is not associated to a locked service |
||
76 | */ |
||
77 | public function __get(string $key) |
||
87 | |||
88 | /** |
||
89 | * Sets new attributes to Jarvis. Note that this method is reserved to Jarvis itself only. |
||
90 | * |
||
91 | * @param string $key The key name of the new attribute |
||
92 | * @param mixed $value The value to associate to provided key |
||
93 | * @throws \LogicException if this method is not called by Jarvis itself |
||
94 | */ |
||
95 | public function __set(string $key, $value) |
||
103 | |||
104 | /** |
||
105 | * {@inheritdoc} |
||
106 | */ |
||
107 | public function offsetSet($id, $v): void |
||
134 | |||
135 | |||
136 | /** |
||
137 | * @param ContainerProviderInterface $provider |
||
138 | */ |
||
139 | public function hydrate(ContainerProviderInterface $provider): void |
||
143 | |||
144 | /** |
||
145 | * @param Request|null $request |
||
146 | * @return Response |
||
147 | */ |
||
148 | public function run(Request $request = null): Response |
||
173 | |||
174 | /** |
||
175 | * {@inheritdoc} |
||
176 | */ |
||
177 | public function broadcast(string $name, EventInterface $event = null): void |
||
188 | |||
189 | /** |
||
190 | * {@inheritdoc} |
||
191 | */ |
||
192 | protected function runReceiverCallback($receiver, EventInterface $event) |
||
193 | { |
||
194 | $this[CallbackResolver::class]->resolveAndCall($receiver, ['event' => $event]); |
||
195 | } |
||
196 | |||
197 | /** |
||
198 | * Sets new attribute into Jarvis. |
||
199 | * |
||
200 | * @param string $key The name of the new attribute |
||
201 | * @param mixed $value The value of the new attribute |
||
202 | */ |
||
203 | private function masterSet(string $key, $value): void |
||
209 | |||
210 | /** |
||
211 | * Enables master emitter mode. |
||
212 | */ |
||
213 | private function masterBroadcast(string $name, EventInterface $event = null): void |
||
219 | } |
||
220 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.