Conditions | 7 |
Paths | 7 |
Total Lines | 23 |
Lines | 8 |
Ratio | 34.78 % |
Tests | 0 |
CRAP Score | 56 |
Changes | 0 |
1 | <?php |
||
24 | public function is_correct( $a, $comparison_operator, $b ) { |
||
25 | View Code Duplication | if ( ! is_scalar( $a ) ) { |
|
26 | Incorrect_Syntax_Exception::raise( 'Environment value for comparison is not scalar: ' . print_r( $a, true ) ); |
||
27 | return false; |
||
28 | } |
||
29 | |||
30 | View Code Duplication | if ( ! is_scalar( $b ) ) { |
|
31 | Incorrect_Syntax_Exception::raise( 'Supplied comparison value is not scalar: ' . print_r( $b, true ) ); |
||
32 | return false; |
||
33 | } |
||
34 | |||
35 | switch ( $comparison_operator ) { |
||
36 | case '>': |
||
37 | return $a > $b; |
||
38 | case '>=': |
||
39 | return $a >= $b; |
||
40 | case '<': |
||
41 | return $a < $b; |
||
42 | case '<=': |
||
43 | return $a <= $b; |
||
44 | } |
||
45 | return false; |
||
46 | } |
||
47 | } |