| Conditions | 1 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 23 |
| Ratio | 100 % |
| Tests | 14 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 3 | public function register(Container $container) |
|
| 17 | { |
||
| 18 | 3 | $this->registerRequirements($container); |
|
| 19 | |||
| 20 | 1 | $container['errorHandler.defaultProvider'] = function () use ($container) { |
|
| 21 | 1 | throw new \RuntimeException('Please configure your default provider for error handler!'); |
|
| 22 | }; |
||
| 23 | |||
| 24 | 2 | $container['errorHandler.providers'] = function () use ($container) { |
|
| 25 | 2 | return []; |
|
| 26 | }; |
||
| 27 | |||
| 28 | 3 | $container['errorHandler.middleware'] = function () use ($container) { |
|
| 29 | 3 | return new ErrorHandlerMiddleware( |
|
| 30 | 3 | new AdvancedErrorHandler( |
|
| 31 | 3 | $container['errorHandler.contentTypeResolver'], |
|
| 32 | 3 | $container['errorHandler.defaultProvider'], |
|
| 33 | 2 | $container['errorHandler.providers'], |
|
| 34 | 2 | $container['logger'] ?? null |
|
| 35 | ) |
||
| 36 | ); |
||
| 37 | }; |
||
| 38 | 3 | } |
|
| 39 | |||
| 54 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.