Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
34 | public function validate(Collection $collection) |
||
35 | { |
||
36 | foreach ($collection->getIterator() as $entity) { |
||
37 | if (is_null($collection->getValidator())) { |
||
38 | continue; |
||
39 | } |
||
40 | |||
41 | $filter = $this->filter->newSubjectFilter($entity->getValidator()); |
||
42 | |||
43 | try { |
||
44 | $filter($entity->toArray()); |
||
45 | } catch (FilterFailed $e) { |
||
46 | throw new ValidationException($e->getMessage()); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | return true; |
||
51 | } |
||
52 | } |
||
53 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.