| @@ 971-975 (lines=5) @@ | ||
| 968 | 'value' => '', |
|
| 969 | ), $rule ); |
|
| 970 | ||
| 971 | if ( ! in_array( $rule['compare'], $allowed_operators ) ) { |
|
| 972 | Incorrect_Syntax_Exception::raise( 'Invalid conditional logic compare operator: <code>' . $rule['compare'] . '</code><br>Allowed operators are: <code>' . |
|
| 973 | implode( ', ', $allowed_operators ) . '</code>' ); |
|
| 974 | return null; |
|
| 975 | } |
|
| 976 | ||
| 977 | if ( in_array( $rule['compare'], $array_operators ) && ! is_array( $rule['value'] ) ) { |
|
| 978 | Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. An array is expected, when using the "' . $rule['compare'] . '" operator.' ); |
|
| @@ 977-980 (lines=4) @@ | ||
| 974 | return null; |
|
| 975 | } |
|
| 976 | ||
| 977 | if ( in_array( $rule['compare'], $array_operators ) && ! is_array( $rule['value'] ) ) { |
|
| 978 | Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. An array is expected, when using the "' . $rule['compare'] . '" operator.' ); |
|
| 979 | return null; |
|
| 980 | } |
|
| 981 | ||
| 982 | return $rule; |
|
| 983 | } |
|
| @@ 372-375 (lines=4) @@ | ||
| 369 | $relation = strtoupper( $array[ $relation_key ] ); |
|
| 370 | } |
|
| 371 | ||
| 372 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
| 373 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $relation . '. ' . |
|
| 374 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
| 375 | } |
|
| 376 | ||
| 377 | return $relation; |
|
| 378 | } |
|