Code Duplication    Length = 4-7 lines in 3 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/Complex_Field.php 1 location

@@ 554-560 (lines=7) @@
551
			static::LAYOUT_TABBED_VERTICAL,
552
		);
553
554
		if ( ! in_array( $layout,  $available_layouts ) ) {
555
			$error_message = 'Incorrect layout ``' . $layout . '" specified. ' .
556
				'Available layouts: ' . implode( ', ', $available_layouts );
557
558
			Incorrect_Syntax_Exception::raise( $error_message );
559
			return $this;
560
		}
561
562
		$this->layout = $layout;
563

core/Field/Field.php 1 location

@@ 864-869 (lines=6) @@
861
			if ( empty( $rule['compare'] ) ) {
862
				$rule['compare'] = '=';
863
			}
864
			if ( ! in_array( $rule['compare'], $allowed_operators ) ) {
865
				Incorrect_Syntax_Exception::raise( 'Invalid conditional logic compare operator: <code>' .
866
					$rule['compare'] . '</code><br>Allowed operators are: <code>' .
867
				implode( ', ', $allowed_operators ) . '</code>' );
868
				return array();
869
			}
870
			if ( $rule['compare'] === 'IN' || $rule['compare'] === 'NOT IN' ) {
871
				if ( ! is_array( $rule['value'] ) ) {
872
					Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. ' .