Code Duplication    Length = 4-5 lines in 2 locations

core/Helper/Helper.php 1 location

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

core/Field/Field.php 1 location

@@ 863-867 (lines=5) @@
860
			if ( empty( $rule['compare'] ) ) {
861
				$rule['compare'] = '=';
862
			}
863
			if ( ! in_array( $rule['compare'], $allowed_operators ) ) {
864
				Incorrect_Syntax_Exception::raise( 'Invalid conditional logic compare operator: <code>' .
865
					$rule['compare'] . '</code><br>Allowed operators are: <code>' .
866
				implode( ', ', $allowed_operators ) . '</code>' );
867
			}
868
			if ( $rule['compare'] === 'IN' || $rule['compare'] === 'NOT IN' ) {
869
				if ( ! is_array( $rule['value'] ) ) {
870
					Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. ' .