Code Duplication    Length = 4-5 lines in 2 locations

core/Helper/Helper.php 1 location

@@ 272-275 (lines=4) @@
269
			$relation = strtoupper( $array[ $relation_key ] );
270
		}
271
272
		if ( ! in_array( $relation, $allowed_relations ) ) {
273
			Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $relation . '. ' .
274
			'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' );
275
		}
276
277
		return $relation;
278
	}

core/Field/Field.php 1 location

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