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