Code Duplication    Length = 4-5 lines in 2 locations

core/Field/Field.php 1 location

@@ 985-989 (lines=5) @@
982
				'value' => '',
983
			), $rule );
984
985
			if ( ! in_array( $rule['compare'], $allowed_operators ) ) {
986
				Incorrect_Syntax_Exception::raise( 'Invalid conditional logic compare operator: <code>' . $rule['compare'] . '</code><br>Allowed operators are: <code>' .
987
				implode( ', ', $allowed_operators ) . '</code>' );
988
				return array();
989
			}
990
991
			if ( in_array( $rule['compare'], array( 'IN', 'NOT IN' ) ) && ! is_array( $rule['value'] ) ) {
992
				Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. An array is expected, when using the "' . $rule['compare'] . '" operator.' );

core/Helper/Helper.php 1 location

@@ 283-286 (lines=4) @@
280
			$relation = strtoupper( $array[ $relation_key ] );
281
		}
282
283
		if ( ! in_array( $relation, $allowed_relations ) ) {
284
			Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $relation . '. ' .
285
			'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' );
286
		}
287
288
		return $relation;
289
	}