Code Duplication    Length = 4-6 lines in 3 locations

core/Field/Complex_Field.php 1 location

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

core/Field/Field.php 2 locations

@@ 806-809 (lines=4) @@
803
			if ( $key === 'relation' ) {
804
				$relation = strtoupper( $rule );
805
806
				if ( ! in_array( $relation, $allowed_relations ) ) {
807
					Incorrect_Syntax_Exception::raise( 'Invalid relation type ' . $rule . '. ' .
808
					'The rule should be one of the following: "' . implode( '", "', $allowed_relations ) . '"' );
809
				}
810
811
				$parsed_rules['relation'] = $relation;
812
				continue;
@@ 825-829 (lines=5) @@
822
			if ( empty( $rule['compare'] ) ) {
823
				$rule['compare'] = '=';
824
			}
825
			if ( ! in_array( $rule['compare'], $allowed_operators ) ) {
826
				Incorrect_Syntax_Exception::raise( 'Invalid conditional logic compare operator: <code>' .
827
					$rule['compare'] . '</code><br>Allowed operators are: <code>' .
828
				implode( ', ', $allowed_operators ) . '</code>' );
829
			}
830
			if ( $rule['compare'] === 'IN' || $rule['compare'] === 'NOT IN' ) {
831
				if ( ! is_array( $rule['value'] ) ) {
832
					Incorrect_Syntax_Exception::raise( 'Invalid conditional logic value format. ' .