Conditions | 5 |
Paths | 5 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
19 | 30 | public function check(Resource $resource) |
|
20 | { |
||
21 | 30 | foreach ($resource->mandatory() as $mandatoryProperty => $value) { |
|
22 | 17 | if (isset($value['when']['condition'])) { |
|
23 | 2 | $when = $value['when']; |
|
24 | 2 | if ('is_present' == $when['condition']) { |
|
25 | 2 | if (!$resource->hasProperty($mandatoryProperty)) { |
|
26 | 2 | throw new \Sensorario\Resources\Exceptions\PropertyNotSetException( |
|
27 | 2 | "Property `" . get_class($resource) |
|
28 | 17 | . "::\${$mandatoryProperty}` is mandatory but not set" |
|
29 | ); |
||
30 | } |
||
31 | } |
||
32 | } |
||
33 | } |
||
34 | 28 | } |
|
35 | } |
||
36 |