| Conditions | 5 |
| Paths | 5 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5.1502 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 39 | 12 | public function authorize() |
|
| 40 | { |
||
| 41 | 12 | $permission = 'admin.job.titles'; |
|
| 42 | |||
| 43 | // Create |
||
| 44 | 12 | if ($this->isMethod('post')) { |
|
| 45 | 8 | return $this->logged_user->hasAccess($permission.'.create'); |
|
|
|
|||
| 46 | } // Delete |
||
| 47 | else { |
||
| 48 | 8 | if ($this->isMethod('delete')) { |
|
| 49 | 4 | return $this->logged_user->hasAccess($permission.'.delete'); |
|
| 50 | } // View |
||
| 51 | else { |
||
| 52 | 4 | if ($this->isMethod('get')) { |
|
| 53 | return $this->logged_user->hasAccess($permission.'.view'); |
||
| 54 | } // Update |
||
| 55 | else { |
||
| 56 | 4 | if ($this->isMethod('patch')) { |
|
| 57 | 4 | return $this->logged_user->hasAccess($permission.'.update'); |
|
| 58 | } |
||
| 59 | } |
||
| 60 | } |
||
| 61 | } |
||
| 62 | } |
||
| 63 | } |
||
| 64 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.