| Conditions | 5 |
| Paths | 5 |
| Total Lines | 23 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function is_fulfilled( $environment ) { |
||
| 34 | $user_id = $environment['user_id']; |
||
| 35 | switch ( $this->get_comparison_operator() ) { |
||
| 36 | case '=': |
||
| 37 | return user_can( $user_id, $this->get_value() ); |
||
| 38 | break; |
||
|
1 ignored issue
–
show
|
|||
| 39 | case '!=': |
||
| 40 | return ! user_can( $user_id, $this->get_value() ); |
||
| 41 | break; |
||
|
1 ignored issue
–
show
|
|||
| 42 | case 'IN': |
||
| 43 | return $this->user_can_any( $user_id, $this->get_value() ); |
||
| 44 | break; |
||
|
1 ignored issue
–
show
|
|||
| 45 | case 'NOT IN': |
||
| 46 | return ! $this->user_can_any( $user_id, $this->get_value() ); |
||
| 47 | break; |
||
|
1 ignored issue
–
show
|
|||
| 48 | } |
||
| 49 | |||
| 50 | return $this->first_supported_comparer_is_correct( |
||
| 51 | $user_id, |
||
| 52 | $this->get_comparison_operator(), |
||
| 53 | $this->get_value() |
||
| 54 | ); |
||
| 55 | } |
||
| 56 | } |
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.