Code Duplication    Length = 4-6 lines in 3 locations

core/Field/Field.php 2 locations

@@ 767-770 (lines=4) @@
764
			if ( $key === 'relation' ) {
765
				$relation = strtoupper( $rule );
766
767
				if ( ! in_array( $relation, $allowed_relations ) ) {
768
					Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' .
769
					'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' );
770
				}
771
772
				$parsed_rules['relation'] = $relation;
773
				continue;
@@ 786-790 (lines=5) @@
783
			if ( empty( $rule['compare'] ) ) {
784
				$rule['compare'] = '=';
785
			}
786
			if ( ! in_array( $rule['compare'], $allowed_operators ) ) {
787
				Incorrect_Syntax_Exception::raise( 'Invalid conditional logic compare operator: <code>' .
788
					$rule['compare'] . '</code><br>Allowed operators are: <code>' .
789
				implode( ', ', $allowed_operators ) . '</code>' );
790
			}
791
			if ( $rule['compare'] === 'IN' || $rule['compare'] === 'NOT IN' ) {
792
				if ( ! is_array( $rule['value'] ) ) {
793
					Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. ' .

core/Field/Complex_Field.php 1 location

@@ 588-593 (lines=6) @@
585
			$layout = self::LAYOUT_TABBED_HORIZONTAL;
586
		}
587
588
		if ( ! in_array( $layout,  $available_layouts ) ) {
589
			$error_message = 'Incorrect layout ``' . $layout . '" specified. ' .
590
				'Available layouts: ' . implode( ', ', $available_layouts );
591
592
			Incorrect_Syntax_Exception::raise( $error_message );
593
		}
594
595
		if ( $layout === self::LAYOUT_LIST ) {
596
			_doing_it_wrong( __METHOD__, __( 'Complex field <code>' . self::LAYOUT_LIST . '</code> layout is deprecated, please use <code>set_width()</code> instead.', 'carbon_fields' ), null );