| Conditions | 4 |
| Paths | 4 |
| Total Lines | 27 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4.7286 |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | 1104 | public function register(Container $app) |
|
| 13 | { |
||
| 14 | 1104 | if (!isset($app['twig'])) { |
|
| 15 | throw new \LogicException( |
||
| 16 | 'You must register the TwigServiceProvider to use the TwigLintServiceProvider.' |
||
| 17 | ); |
||
| 18 | } |
||
| 19 | |||
| 20 | 1104 | if (!isset($app['validator'])) { |
|
| 21 | throw new \LogicException( |
||
| 22 | 'You must register the ValidatorServiceProvider to use the TwigLintServiceProvider.' |
||
| 23 | ); |
||
| 24 | } |
||
| 25 | |||
| 26 | 17 | $app[TwigLintValidator::class] = function (Container $app) { |
|
| 27 | 17 | return new TwigLintValidator($app['twig']); |
|
| 28 | }; |
||
| 29 | |||
| 30 | 1104 | if (!isset($app['validator.validator_service_ids'])) { |
|
| 31 | $app['validator.validator_service_ids'] = []; |
||
| 32 | } |
||
| 33 | |||
| 34 | 1104 | $app['validator.validator_service_ids'] = array_merge( |
|
| 35 | 1104 | $app['validator.validator_service_ids'], |
|
| 36 | 1104 | [TwigLintValidator::class => TwigLintValidator::class] |
|
| 37 | ); |
||
| 38 | } |
||
| 39 | } |
||
| 40 |