Code Duplication    Length = 4-7 lines in 3 locations

core/Helper/Helper.php 1 location

@@ 223-226 (lines=4) @@
220
			$relation = strtoupper( $array[ $relation_key ] );
221
		}
222
223
		if ( ! in_array( $relation, $allowed_relations ) ) {
224
			Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $relation . '. ' .
225
			'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' );
226
		}
227
228
		return $relation;
229
	}

core/Field/Field.php 1 location

@@ 932-937 (lines=6) @@
929
				'value' => '',
930
			), $rule );
931
932
			if ( ! in_array( $rule['compare'], $allowed_operators ) ) {
933
				Incorrect_Syntax_Exception::raise( 'Invalid conditional logic compare operator: <code>' . $rule['compare'] . '</code><br>Allowed operators are: <code>' .
934
				implode( ', ', $allowed_operators ) . '</code>' );
935
				return array();
936
			}
937
938
			if ( in_array( $rule['compare'], array( 'IN', 'NOT IN' ) ) && ! is_array( $rule['value'] ) ) {
939
				Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. An array is expected, when using the "' . $rule['compare'] . '" operator.' );
940
				return array();

core/Field/Complex_Field.php 1 location

@@ 595-601 (lines=7) @@
592
			static::LAYOUT_TABBED_VERTICAL,
593
		);
594
595
		if ( ! in_array( $layout,  $available_layouts ) ) {
596
			$error_message = 'Incorrect layout ``' . $layout . '" specified. ' .
597
				'Available layouts: ' . implode( ', ', $available_layouts );
598
599
			Incorrect_Syntax_Exception::raise( $error_message );
600
			return $this;
601
		}
602
603
		$this->layout = $layout;
604