1 | <?php |
||
31 | class Jarvis extends Container implements BroadcasterInterface |
||
32 | { |
||
33 | use BroadcasterTrait { |
||
34 | broadcast as traitBroadcast; |
||
35 | } |
||
36 | |||
37 | const DEFAULT_DEBUG = false; |
||
38 | const CONTAINER_PROVIDER_FQCN = ContainerProvider::class; |
||
39 | |||
40 | private $masterSetter = false; |
||
41 | |||
42 | /** |
||
43 | * Creates an instance of Jarvis. It can take settings as first argument. |
||
44 | * List of accepted options: |
||
45 | * - providers (type: string|array): fqcn of your container provider |
||
46 | * - extra |
||
47 | * |
||
48 | * @param array $settings Your own settings to modify Jarvis behavior |
||
49 | */ |
||
50 | public function __construct(array $settings = []) |
||
60 | |||
61 | public function __destruct() |
||
65 | |||
66 | /** |
||
67 | * This method is an another way to get a locked value. |
||
68 | * |
||
69 | * Example: $this['foo'] is equal to $this->foo, but it ONLY works for locked values. |
||
70 | * |
||
71 | * @param string $key The key of the locked value |
||
72 | * @return mixed |
||
73 | * @throws \InvalidArgumentException if the requested key is not associated to a locked service |
||
74 | */ |
||
75 | public function __get(string $key) |
||
85 | |||
86 | /** |
||
87 | * Sets new attributes to Jarvis. Note that this method is reserved to Jarvis itself only. |
||
88 | * |
||
89 | * @param string $key The key name of the new attribute |
||
90 | * @param mixed $value The value to associate to provided key |
||
91 | * @throws \LogicException if this method is not called by Jarvis itself |
||
92 | */ |
||
93 | public function __set(string $key, $value) |
||
101 | |||
102 | /** |
||
103 | * {@inheritdoc} |
||
104 | */ |
||
105 | public function offsetSet($id, $v): void |
||
132 | |||
133 | |||
134 | /** |
||
135 | * @param ContainerProviderInterface $provider |
||
136 | */ |
||
137 | public function hydrate(ContainerProviderInterface $provider): void |
||
141 | |||
142 | /** |
||
143 | * @param Request|null $request |
||
144 | * @return Response |
||
145 | */ |
||
146 | public function run(Request $request = null): Response |
||
171 | |||
172 | /** |
||
173 | * {@inheritdoc} |
||
174 | */ |
||
175 | public function broadcast(string $name, EventInterface $event = null): void |
||
186 | |||
187 | /** |
||
188 | * Sets new attribute into Jarvis. |
||
189 | * |
||
190 | * @param string $key The name of the new attribute |
||
191 | * @param mixed $value The value of the new attribute |
||
192 | */ |
||
193 | private function masterSet(string $key, $value): void |
||
199 | |||
200 | /** |
||
201 | * Enables master emitter mode. |
||
202 | */ |
||
203 | private function masterBroadcast(string $name, EventInterface $event = null): void |
||
209 | } |
||
210 |
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.