| Conditions | 7 |
| Paths | 8 |
| Total Lines | 22 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 14.2702 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | 1 | public function initAnnotation(array $properties) { |
|
| 30 | 1 | if (isset($properties[0])) { |
|
| 31 | $this->role = $properties[0]; |
||
| 32 | unset($properties[0]); |
||
| 33 | if (isset($properties[1])) { |
||
| 34 | $this->resource = $properties[1]; |
||
| 35 | unset($properties[1]); |
||
| 36 | if (isset($properties[2])) { |
||
| 37 | $this->permission = $properties[2]; |
||
| 38 | unset($properties[2]); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | 1 | } else if (isset($properties['role'])) { |
|
| 42 | 1 | $this->role = $properties['role']; |
|
| 43 | 1 | if (isset($properties['resource'])) { |
|
| 44 | 1 | $this->resource = $properties['resource']; |
|
| 45 | } |
||
| 46 | 1 | if (isset($properties['permission'])) { |
|
| 47 | 1 | $this->permission = $properties['permission']; |
|
| 48 | } |
||
| 49 | } else { |
||
| 50 | throw new \Exception('Allow annotation must have a role'); |
||
| 51 | } |
||
| 54 |