@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | public function initAnnotations(ContainerInterface $container, bool $reset = false): void |
125 | 125 | { |
126 | 126 | $prototyped = $this->memory->loadData('prototyped'); |
127 | - if (!$reset && $prototyped !== null) { |
|
128 | - foreach ($prototyped as $property => $class) { |
|
127 | + if (!$reset && $prototyped !== null){ |
|
128 | + foreach ($prototyped as $property => $class){ |
|
129 | 129 | $this->bindProperty($property, $class); |
130 | 130 | } |
131 | 131 | |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | $reader = $container->get(ReaderInterface::class); |
138 | 138 | |
139 | 139 | $prototyped = []; |
140 | - foreach ($locator->getClasses() as $class) { |
|
140 | + foreach ($locator->getClasses() as $class){ |
|
141 | 141 | $meta = $reader->firstClassMetadata($class, Prototyped::class); |
142 | 142 | |
143 | - if ($meta === null) { |
|
143 | + if ($meta === null){ |
|
144 | 144 | continue; |
145 | 145 | } |
146 | 146 | |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public function initCycle(ContainerInterface $container): void |
158 | 158 | { |
159 | - if (!$container->has(ORM\SchemaInterface::class)) { |
|
159 | + if (!$container->has(ORM\SchemaInterface::class)){ |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
163 | 163 | /** @var ORM\SchemaInterface|null $schema */ |
164 | 164 | $schema = $container->get(ORM\SchemaInterface::class); |
165 | - if ($schema === null) { |
|
165 | + if ($schema === null){ |
|
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | - foreach ($schema->getRoles() as $role) { |
|
169 | + foreach ($schema->getRoles() as $role){ |
|
170 | 170 | $repository = $schema->define($role, ORM\SchemaInterface::REPOSITORY); |
171 | - if ($repository === ORM\Select\Repository::class || $repository === null) { |
|
171 | + if ($repository === ORM\Select\Repository::class || $repository === null){ |
|
172 | 172 | // default repository can not be wired |
173 | 173 | continue; |
174 | 174 | } |
@@ -179,23 +179,23 @@ discard block |
||
179 | 179 | |
180 | 180 | private function initDefaults(ContainerInterface $container): void |
181 | 181 | { |
182 | - foreach (self::DEFAULT_SHORTCUTS as $property => $shortcut) { |
|
183 | - if (is_array($shortcut) && isset($shortcut['resolve'])) { |
|
184 | - if (isset($shortcut['with'])) { |
|
182 | + foreach (self::DEFAULT_SHORTCUTS as $property => $shortcut){ |
|
183 | + if (is_array($shortcut) && isset($shortcut['resolve'])){ |
|
184 | + if (isset($shortcut['with'])){ |
|
185 | 185 | // check dependencies |
186 | - foreach ($shortcut['with'] as $dep) { |
|
187 | - if (!class_exists($dep, true) && !interface_exists($dep, true)) { |
|
186 | + foreach ($shortcut['with'] as $dep){ |
|
187 | + if (!class_exists($dep, true) && !interface_exists($dep, true)){ |
|
188 | 188 | continue 2; |
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
193 | - try { |
|
193 | + try{ |
|
194 | 194 | $target = $container->get($shortcut['resolve']); |
195 | - if (is_object($target)) { |
|
195 | + if (is_object($target)){ |
|
196 | 196 | $this->bindProperty($property, get_class($target)); |
197 | 197 | } |
198 | - } catch (ContainerExceptionInterface $e) { |
|
198 | + }catch (ContainerExceptionInterface $e){ |
|
199 | 199 | continue; |
200 | 200 | } |
201 | 201 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | is_string($shortcut) |
207 | 207 | && (class_exists($shortcut, true) |
208 | 208 | || interface_exists($shortcut, true)) |
209 | - ) { |
|
209 | + ){ |
|
210 | 210 | $this->bindProperty($property, $shortcut); |
211 | 211 | } |
212 | 212 | } |
@@ -124,8 +124,10 @@ discard block |
||
124 | 124 | public function initAnnotations(ContainerInterface $container, bool $reset = false): void |
125 | 125 | { |
126 | 126 | $prototyped = $this->memory->loadData('prototyped'); |
127 | - if (!$reset && $prototyped !== null) { |
|
128 | - foreach ($prototyped as $property => $class) { |
|
127 | + if (!$reset && $prototyped !== null) |
|
128 | + { |
|
129 | + foreach ($prototyped as $property => $class) |
|
130 | + { |
|
129 | 131 | $this->bindProperty($property, $class); |
130 | 132 | } |
131 | 133 | |
@@ -137,10 +139,12 @@ discard block |
||
137 | 139 | $reader = $container->get(ReaderInterface::class); |
138 | 140 | |
139 | 141 | $prototyped = []; |
140 | - foreach ($locator->getClasses() as $class) { |
|
142 | + foreach ($locator->getClasses() as $class) |
|
143 | + { |
|
141 | 144 | $meta = $reader->firstClassMetadata($class, Prototyped::class); |
142 | 145 | |
143 | - if ($meta === null) { |
|
146 | + if ($meta === null) |
|
147 | + { |
|
144 | 148 | continue; |
145 | 149 | } |
146 | 150 | |
@@ -156,19 +160,23 @@ discard block |
||
156 | 160 | */ |
157 | 161 | public function initCycle(ContainerInterface $container): void |
158 | 162 | { |
159 | - if (!$container->has(ORM\SchemaInterface::class)) { |
|
163 | + if (!$container->has(ORM\SchemaInterface::class)) |
|
164 | + { |
|
160 | 165 | return; |
161 | 166 | } |
162 | 167 | |
163 | 168 | /** @var ORM\SchemaInterface|null $schema */ |
164 | 169 | $schema = $container->get(ORM\SchemaInterface::class); |
165 | - if ($schema === null) { |
|
170 | + if ($schema === null) |
|
171 | + { |
|
166 | 172 | return; |
167 | 173 | } |
168 | 174 | |
169 | - foreach ($schema->getRoles() as $role) { |
|
175 | + foreach ($schema->getRoles() as $role) |
|
176 | + { |
|
170 | 177 | $repository = $schema->define($role, ORM\SchemaInterface::REPOSITORY); |
171 | - if ($repository === ORM\Select\Repository::class || $repository === null) { |
|
178 | + if ($repository === ORM\Select\Repository::class || $repository === null) |
|
179 | + { |
|
172 | 180 | // default repository can not be wired |
173 | 181 | continue; |
174 | 182 | } |
@@ -179,23 +187,32 @@ discard block |
||
179 | 187 | |
180 | 188 | private function initDefaults(ContainerInterface $container): void |
181 | 189 | { |
182 | - foreach (self::DEFAULT_SHORTCUTS as $property => $shortcut) { |
|
183 | - if (is_array($shortcut) && isset($shortcut['resolve'])) { |
|
184 | - if (isset($shortcut['with'])) { |
|
190 | + foreach (self::DEFAULT_SHORTCUTS as $property => $shortcut) |
|
191 | + { |
|
192 | + if (is_array($shortcut) && isset($shortcut['resolve'])) |
|
193 | + { |
|
194 | + if (isset($shortcut['with'])) |
|
195 | + { |
|
185 | 196 | // check dependencies |
186 | - foreach ($shortcut['with'] as $dep) { |
|
187 | - if (!class_exists($dep, true) && !interface_exists($dep, true)) { |
|
197 | + foreach ($shortcut['with'] as $dep) |
|
198 | + { |
|
199 | + if (!class_exists($dep, true) && !interface_exists($dep, true)) |
|
200 | + { |
|
188 | 201 | continue 2; |
189 | 202 | } |
190 | 203 | } |
191 | 204 | } |
192 | 205 | |
193 | - try { |
|
206 | + try |
|
207 | + { |
|
194 | 208 | $target = $container->get($shortcut['resolve']); |
195 | - if (is_object($target)) { |
|
209 | + if (is_object($target)) |
|
210 | + { |
|
196 | 211 | $this->bindProperty($property, get_class($target)); |
197 | 212 | } |
198 | - } catch (ContainerExceptionInterface $e) { |
|
213 | + } |
|
214 | + catch (ContainerExceptionInterface $e) |
|
215 | + { |
|
199 | 216 | continue; |
200 | 217 | } |
201 | 218 |