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

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