Code Duplication    Length = 4-5 lines in 3 locations

core/Helper/Helper.php 1 location

@@ 373-376 (lines=4) @@
370
			$relation = strtoupper( $array[ $relation_key ] );
371
		}
372
373
		if ( ! in_array( $relation, $allowed_relations ) ) {
374
			Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $relation . '. ' .
375
			'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' );
376
		}
377
378
		return $relation;
379
	}

core/Field/Field.php 2 locations

@@ 950-954 (lines=5) @@
947
			'value' => '',
948
		), $rule );
949
950
		if ( ! in_array( $rule['compare'], $allowed_operators ) ) {
951
			Incorrect_Syntax_Exception::raise( 'Invalid conditional logic compare operator: <code>' . $rule['compare'] . '</code><br>Allowed operators are: <code>' .
952
			implode( ', ', $allowed_operators ) . '</code>' );
953
			return null;
954
		}
955
956
		if ( in_array( $rule['compare'], $array_operators ) && ! is_array( $rule['value'] ) ) {
957
			Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. An array is expected, when using the "' . $rule['compare'] . '" operator.' );
@@ 956-959 (lines=4) @@
953
			return null;
954
		}
955
956
		if ( in_array( $rule['compare'], $array_operators ) && ! is_array( $rule['value'] ) ) {
957
			Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. An array is expected, when using the "' . $rule['compare'] . '" operator.' );
958
			return null;
959
		}
960
961
		return $rule;
962
	}