We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Total Complexity | 8 | 
| Total Lines | 54 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 28 | final class Each extends AbstractRule  | 
            ||
| 29 | { | 
            ||
| 30 | use CanValidateIterable;  | 
            ||
| 31 | |||
| 32 | /**  | 
            ||
| 33 | * @var Validatable  | 
            ||
| 34 | */  | 
            ||
| 35 | private $rule;  | 
            ||
| 36 | |||
| 37 | /**  | 
            ||
| 38 | * Initializes the constructor.  | 
            ||
| 39 | *  | 
            ||
| 40 | * @param mixed $rule  | 
            ||
| 41 | */  | 
            ||
| 42 | 3 | public function __construct(Validatable $rule)  | 
            |
| 43 |     { | 
            ||
| 44 | 3 | $this->rule = $rule;  | 
            |
| 45 | 3 | }  | 
            |
| 46 | |||
| 47 | /**  | 
            ||
| 48 |      * {@inheritdoc} | 
            ||
| 49 | */  | 
            ||
| 50 | 11 | public function assert($input): void  | 
            |
| 51 |     { | 
            ||
| 52 | 11 |         if (!$this->isIterable($input)) { | 
            |
| 53 | 5 | throw $this->reportError($input);  | 
            |
| 54 | }  | 
            ||
| 55 | |||
| 56 | 7 | $exceptions = [];  | 
            |
| 57 | 7 |         foreach ($input as $value) { | 
            |
| 58 |             try { | 
            ||
| 59 | 6 | $this->rule->check($value);  | 
            |
| 60 | 2 |             } catch (ValidationException $exception) { | 
            |
| 61 | 6 | $exceptions[] = $exception;  | 
            |
| 62 | }  | 
            ||
| 63 | }  | 
            ||
| 64 | |||
| 65 | 7 |         if (!empty($exceptions)) { | 
            |
| 66 | 2 | throw $this->reportError($input)->setRelated($exceptions);  | 
            |
| 
                                                                                                    
                        
                         | 
                |||
| 67 | }  | 
            ||
| 68 | 5 | }  | 
            |
| 69 | |||
| 70 | /**  | 
            ||
| 71 |      * {@inheritdoc} | 
            ||
| 72 | */  | 
            ||
| 73 | 11 | public function validate($input): bool  | 
            |
| 82 | }  | 
            ||
| 83 | }  | 
            ||
| 84 |