| Conditions | 10 | 
| Paths | 11 | 
| Total Lines | 31 | 
| Code Lines | 18 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 35 | public function check(array $configuration): void  | 
            ||
| 36 |     { | 
            ||
| 37 |         foreach ($configuration as $eventName => $listeners) { | 
            ||
| 38 |             if (!is_string($eventName) || !class_exists($eventName)) { | 
            ||
| 39 | throw new InvalidEventConfigurationFormatException(  | 
            ||
| 40 | 'Incorrect event listener format. Format with event name must be used.'  | 
            ||
| 41 | );  | 
            ||
| 42 | }  | 
            ||
| 43 | |||
| 44 |             if (!is_iterable($listeners)) { | 
            ||
| 45 | $type = is_object($listeners) ? get_class($listeners) : gettype($listeners);  | 
            ||
| 46 | |||
| 47 | throw new InvalidEventConfigurationFormatException(  | 
            ||
| 48 | "Event listeners for $eventName must be an iterable, $type given."  | 
            ||
| 49 | );  | 
            ||
| 50 | }  | 
            ||
| 51 | |||
| 52 |             foreach ($listeners as $listener) { | 
            ||
| 53 |                 try { | 
            ||
| 54 |                     if (!$this->isCallable($listener)) { | 
            ||
| 55 | $type = is_object($listener) ? get_class($listener) : gettype($listener);  | 
            ||
| 56 | |||
| 57 | throw new InvalidListenerConfigurationException(  | 
            ||
| 58 | "Listener must be a callable, $type given."  | 
            ||
| 59 | );  | 
            ||
| 60 | }  | 
            ||
| 61 |                 } catch (ContainerExceptionInterface $exception) { | 
            ||
| 62 | throw new InvalidListenerConfigurationException(  | 
            ||
| 63 | 'Could not instantiate event listener or listener class has invalid configuration.',  | 
            ||
| 64 | 0,  | 
            ||
| 65 | $exception  | 
            ||
| 66 | );  | 
            ||
| 110 |