| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4.016 |
| Changes | 0 | ||
| 1 | <?php |
||
| 45 | 34 | public function isValid($value) |
|
| 46 | { |
||
| 47 | 34 | $all = $this->manager->getAllResources(); |
|
| 48 | |||
| 49 | 34 | if (!is_array($value)) { |
|
| 50 | throw new InvalidArgumentException('Resources param needs to be an array.'); |
||
| 51 | } |
||
| 52 | |||
| 53 | 34 | foreach ($value as $resource) { |
|
| 54 | 34 | if (!in_array($resource, $all, true)) { |
|
| 55 | 4 | $this->resource = $resource; |
|
| 56 | 4 | $this->error(self::INVALID); |
|
| 57 | 4 | return false; |
|
| 58 | } |
||
| 59 | } |
||
| 60 | |||
| 61 | 32 | return true; |
|
| 62 | } |
||
| 63 | } |
||
| 64 |