| Conditions | 6 |
| Paths | 8 |
| Total Lines | 32 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 50 | public function process(ContainerBuilder $container) |
|
| 22 | { |
||
| 23 | 50 | $ids = $container->findTaggedServiceIds( |
|
| 24 | 50 | 'innmind_rest_server.http.request.verifier' |
|
| 25 | ); |
||
| 26 | 50 | $definition = $container->getDefinition('innmind_rest_server.http.request.verifier'); |
|
| 27 | 50 | $verifiers = []; |
|
| 28 | |||
| 29 | 50 | foreach ($ids as $id => $tags) { |
|
| 30 | 50 | foreach ($tags as $tag => $attributes) { |
|
| 31 | 50 | if (!isset($attributes['priority'])) { |
|
| 32 | 2 | throw new MissingPriority; |
|
| 33 | } |
||
| 34 | |||
| 35 | 50 | $priority = (int) $attributes['priority']; |
|
| 36 | |||
| 37 | 50 | if (isset($verifiers[$priority])) { |
|
| 38 | 2 | throw new PriorityAlreadyUsedByAVerifier( |
|
| 39 | 2 | (string) $priority |
|
| 40 | ); |
||
| 41 | } |
||
| 42 | |||
| 43 | 50 | $verifiers[$priority] = new Reference($id); |
|
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | 46 | krsort($verifiers); |
|
| 48 | |||
| 49 | 46 | foreach ($verifiers as $verifier) { |
|
| 50 | 46 | $definition->addArgument($verifier); |
|
| 51 | } |
||
| 52 | 46 | } |
|
| 53 | } |
||
| 54 |