Code Duplication    Length = 6-11 lines in 2 locations

includes/rest-api/CMB2_REST_Controller_Fields.php 1 location

@@ 128-133 (lines=6) @@
125
			$this->field = $this->rest_box->field_can_read( $field['id'], true );
126
127
			// And make sure current user can view this box.
128
			if ( $this->field && $this->get_item_permissions_check_filter() ) {
129
				$fields[ $field['id'] ] = $this->server->response_to_data(
130
					$this->prepare_field_response(),
131
					isset( $this->request['_embed'] )
132
				);
133
			}
134
		}
135
136
		return $this->prepare_item( $fields );

includes/rest-api/CMB2_REST_Controller_Boxes.php 1 location

@@ 131-141 (lines=11) @@
128
129
		// Loop and prepare boxes data.
130
		foreach ( $boxes as $this->rest_box ) {
131
			if (
132
				// Make sure this box can be read
133
				$this->rest_box->rest_read
134
				// And make sure current user can view this box.
135
				&& $this->get_item_permissions_check_filter( $this->request )
136
			) {
137
				$boxes_data[] = $this->server->response_to_data(
138
					$this->get_rest_box(),
139
					isset( $this->request['_embed'] )
140
				);
141
			}
142
		}
143
144
		return $this->prepare_item( $boxes_data );