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

@@ 578-584 (lines=7) @@
575
			static::LAYOUT_TABBED_VERTICAL,
576
		);
577
578
		if ( ! in_array( $layout,  $available_layouts ) ) {
579
			$error_message = 'Incorrect layout ``' . $layout . '" specified. ' .
580
				'Available layouts: ' . implode( ', ', $available_layouts );
581
582
			Incorrect_Syntax_Exception::raise( $error_message );
583
			return $this;
584
		}
585
586
		$this->layout = $layout;
587