| Conditions | 5 |
| Paths | 5 |
| Total Lines | 23 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | public function is_fulfilled( $environment ) { |
||
| 44 | $user_id = $this->get_user_id( $environment ); |
||
| 45 | switch ( $this->get_comparison_operator() ) { |
||
| 46 | case '=': |
||
| 47 | return user_can( $user_id, $this->get_value() ); |
||
| 48 | break; |
||
|
1 ignored issue
–
show
|
|||
| 49 | case '!=': |
||
| 50 | return ! user_can( $user_id, $this->get_value() ); |
||
| 51 | break; |
||
|
1 ignored issue
–
show
|
|||
| 52 | case 'IN': |
||
| 53 | return $this->user_can_any( $user_id, $this->get_value() ); |
||
| 54 | break; |
||
|
1 ignored issue
–
show
|
|||
| 55 | case 'NOT IN': |
||
| 56 | return ! $this->user_can_any( $user_id, $this->get_value() ); |
||
| 57 | break; |
||
|
1 ignored issue
–
show
|
|||
| 58 | } |
||
| 59 | |||
| 60 | return $this->first_supported_comparer_is_correct( |
||
| 61 | $user_id, |
||
| 62 | $this->get_comparison_operator(), |
||
| 63 | $this->get_value() |
||
| 64 | ); |
||
| 65 | } |
||
| 66 | } |
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.