Code Duplication    Length = 4-6 lines in 3 locations

core/Field/Field.php 2 locations

@@ 760-763 (lines=4) @@
757
			if ( $key === 'relation' ) {
758
				$relation = strtoupper( $rule );
759
760
				if ( ! in_array( $relation, $allowed_relations ) ) {
761
					Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' .
762
					'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' );
763
				}
764
765
				$parsed_rules['relation'] = $relation;
766
				continue;
@@ 779-783 (lines=5) @@
776
			if ( empty( $rule['compare'] ) ) {
777
				$rule['compare'] = '=';
778
			}
779
			if ( ! in_array( $rule['compare'], $allowed_operators ) ) {
780
				Incorrect_Syntax_Exception::raise( 'Invalid conditional logic compare operator: <code>' .
781
					$rule['compare'] . '</code><br>Allowed operators are: <code>' .
782
				implode( ', ', $allowed_operators ) . '</code>' );
783
			}
784
			if ( $rule['compare'] === 'IN' || $rule['compare'] === 'NOT IN' ) {
785
				if ( ! is_array( $rule['value'] ) ) {
786
					Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. ' .

core/Field/Complex_Field.php 1 location

@@ 576-581 (lines=6) @@
573
			$layout = self::LAYOUT_TABBED_HORIZONTAL;
574
		}
575
576
		if ( ! in_array( $layout,  $available_layouts ) ) {
577
			$error_message = 'Incorrect layout ``' . $layout . '" specified. ' .
578
				'Available layouts: ' . implode( ', ', $available_layouts );
579
580
			Incorrect_Syntax_Exception::raise( $error_message );
581
		}
582
583
		if ( $layout === self::LAYOUT_LIST ) {
584
			_doing_it_wrong( __METHOD__, __( 'Complex field <code>' . self::LAYOUT_LIST . '</code> layout is deprecated, please use <code>set_width()</code> instead.', 'carbon_fields' ), null );