| Conditions | 5 |
| Paths | 5 |
| Total Lines | 24 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | public function is_fulfilled( $environment ) { |
||
| 29 | $roles = $this->get_user_roles( $environment ); |
||
| 30 | |||
| 31 | switch ( $this->get_comparison_operator() ) { |
||
| 32 | case '=': |
||
| 33 | return in_array( $this->get_value(), $roles ); |
||
| 34 | break; |
||
|
1 ignored issue
–
show
|
|||
| 35 | case '!=': |
||
| 36 | return ! in_array( $this->get_value(), $roles ); |
||
| 37 | break; |
||
|
1 ignored issue
–
show
|
|||
| 38 | case 'IN': |
||
| 39 | return count( array_intersect( $roles, $this->get_value() ) ) > 0; |
||
| 40 | break; |
||
|
1 ignored issue
–
show
|
|||
| 41 | case 'NOT IN': |
||
| 42 | return count( array_intersect( $roles, $this->get_value() ) ) === 0; |
||
| 43 | break; |
||
|
1 ignored issue
–
show
|
|||
| 44 | } |
||
| 45 | |||
| 46 | return $this->first_supported_comparer_is_correct( |
||
| 47 | $roles, |
||
| 48 | $this->get_comparison_operator(), |
||
| 49 | $this->get_value() |
||
| 50 | ); |
||
| 51 | } |
||
| 52 | } |
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.