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

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