Code Duplication    Length = 9-9 lines in 2 locations

includes/CMB2_REST_Access.php 2 locations

@@ 102-110 (lines=9) @@
99
		}
100
	}
101
102
	protected function maybe_add_read_field( $field_id, $show_in_rest ) {
103
		$can_read = $this->cmb->rest_read
104
			? 'write_only' !== $show_in_rest
105
			: in_array( $show_in_rest, array( 'read_and_write', 'read_only' ), true );
106
107
		if ( $can_read ) {
108
			self::$read_fields[ $this->cmb->cmb_id ][] = $field_id;
109
		}
110
	}
111
112
	protected function maybe_add_write_field( $field_id, $show_in_rest ) {
113
		$can_update = $this->cmb->rest_write
@@ 112-120 (lines=9) @@
109
		}
110
	}
111
112
	protected function maybe_add_write_field( $field_id, $show_in_rest ) {
113
		$can_update = $this->cmb->rest_write
114
			? 'read_only' !== $show_in_rest
115
			: in_array( $show_in_rest, array( 'read_and_write', 'write_only' ), true );
116
117
		if ( $can_update ) {
118
			self::$write_fields[ $this->cmb->cmb_id ][] = $field_id;
119
		}
120
	}
121
122
	/**
123
	 * Handler for getting custom field data.