Code Duplication    Length = 9-9 lines in 2 locations

includes/CMB2_REST.php 2 locations

@@ 126-134 (lines=9) @@
123
		}
124
	}
125
126
	protected function maybe_add_read_field( $field_id, $show_in_rest ) {
127
		$can_read = $this->cmb->rest_read
128
			? 'write_only' !== $show_in_rest
129
			: in_array( $show_in_rest, array( 'read_and_write', 'read_only' ), true );
130
131
		if ( $can_read ) {
132
			self::$read_fields[ $this->cmb->cmb_id ][] = $field_id;
133
		}
134
	}
135
136
	protected function maybe_add_write_field( $field_id, $show_in_rest ) {
137
		$can_update = $this->cmb->rest_write
@@ 136-144 (lines=9) @@
133
		}
134
	}
135
136
	protected function maybe_add_write_field( $field_id, $show_in_rest ) {
137
		$can_update = $this->cmb->rest_write
138
			? 'read_only' !== $show_in_rest
139
			: in_array( $show_in_rest, array( 'read_and_write', 'write_only' ), true );
140
141
		if ( $can_update ) {
142
			self::$write_fields[ $this->cmb->cmb_id ][] = $field_id;
143
		}
144
	}
145
146
	/**
147
	 * Handler for getting custom field data.