Code Duplication    Length = 4-7 lines in 3 locations

core/Field/Complex_Field.php 1 location

@@ 604-610 (lines=7) @@
601
			static::LAYOUT_TABBED_VERTICAL,
602
		);
603
604
		if ( ! in_array( $layout,  $available_layouts ) ) {
605
			$error_message = 'Incorrect layout ``' . $layout . '" specified. ' .
606
				'Available layouts: ' . implode( ', ', $available_layouts );
607
608
			Incorrect_Syntax_Exception::raise( $error_message );
609
			return $this;
610
		}
611
612
		$this->layout = $layout;
613

core/Field/Field.php 1 location

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

core/Helper/Helper.php 1 location

@@ 272-275 (lines=4) @@
269
			$relation = strtoupper( $array[ $relation_key ] );
270
		}
271
272
		if ( ! in_array( $relation, $allowed_relations ) ) {
273
			Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $relation . '. ' .
274
			'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' );
275
		}
276
277
		return $relation;
278
	}