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/Complex_Field.php 1 location

@@ 568-574 (lines=7) @@
565
			static::LAYOUT_TABBED_VERTICAL,
566
		);
567
568
		if ( ! in_array( $layout,  $available_layouts ) ) {
569
			$error_message = 'Incorrect layout ``' . $layout . '" specified. ' .
570
				'Available layouts: ' . implode( ', ', $available_layouts );
571
572
			Incorrect_Syntax_Exception::raise( $error_message );
573
			return $this;
574
		}
575
576
		$this->layout = $layout;
577

core/Field/Field.php 1 location

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