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

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