Code Duplication    Length = 4-5 lines in 2 locations

core/Field/Field.php 1 location

@@ 916-920 (lines=5) @@
913
			if ( empty( $rule['compare'] ) ) {
914
				$rule['compare'] = '=';
915
			}
916
			if ( ! in_array( $rule['compare'], $allowed_operators ) ) {
917
				Incorrect_Syntax_Exception::raise( 'Invalid conditional logic compare operator: <code>' .
918
					$rule['compare'] . '</code><br>Allowed operators are: <code>' .
919
				implode( ', ', $allowed_operators ) . '</code>' );
920
			}
921
			if ( $rule['compare'] === 'IN' || $rule['compare'] === 'NOT IN' ) {
922
				if ( ! is_array( $rule['value'] ) ) {
923
					Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. ' .

core/Helper/Helper.php 1 location

@@ 232-235 (lines=4) @@
229
			$relation = strtoupper( $array[ $relation_key ] );
230
		}
231
232
		if ( ! in_array( $relation, $allowed_relations ) ) {
233
			Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $relation . '. ' .
234
			'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' );
235
		}
236
237
		return $relation;
238
	}