| @@ 943-947 (lines=5) @@ | ||
| 940 | 'value' => '', |
|
| 941 | ), $rule ); |
|
| 942 | ||
| 943 | if ( ! in_array( $rule['compare'], $allowed_operators ) ) { |
|
| 944 | Incorrect_Syntax_Exception::raise( 'Invalid conditional logic compare operator: <code>' . $rule['compare'] . '</code><br>Allowed operators are: <code>' . |
|
| 945 | implode( ', ', $allowed_operators ) . '</code>' ); |
|
| 946 | return null; |
|
| 947 | } |
|
| 948 | ||
| 949 | if ( in_array( $rule['compare'], $array_operators ) && ! is_array( $rule['value'] ) ) { |
|
| 950 | Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. An array is expected, when using the "' . $rule['compare'] . '" operator.' ); |
|
| @@ 949-952 (lines=4) @@ | ||
| 946 | return null; |
|
| 947 | } |
|
| 948 | ||
| 949 | if ( in_array( $rule['compare'], $array_operators ) && ! is_array( $rule['value'] ) ) { |
|
| 950 | Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. An array is expected, when using the "' . $rule['compare'] . '" operator.' ); |
|
| 951 | return null; |
|
| 952 | } |
|
| 953 | ||
| 954 | return $rule; |
|
| 955 | } |
|
| @@ 373-376 (lines=4) @@ | ||
| 370 | $relation = strtoupper( $array[ $relation_key ] ); |
|
| 371 | } |
|
| 372 | ||
| 373 | if ( ! in_array( $relation, $allowed_relations ) ) { |
|
| 374 | Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $relation . '. ' . |
|
| 375 | 'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' ); |
|
| 376 | } |
|
| 377 | ||
| 378 | return $relation; |
|
| 379 | } |
|