Apple_Push_API\Request\Request::delete PHP Method

delete() public method

Sends a DELETE request for the given article and bundles.
Since: 0.2.0
public delete ( string $url ) : mixed
$url string
return mixed
    public function delete($url)
    {
        // Build the delete request args
        $args = array('headers' => array('Authorization' => $this->sign($url, 'DELETE')), 'method' => 'DELETE');
        // Allow filtering and merge with the default args
        $args = apply_filters('apple_news_delete_args', wp_parse_args($args, $this->default_args));
        // Perform the delete
        $response = wp_safe_remote_request(esc_url_raw($url), $args);
        // NULL is a valid response for DELETE
        if (is_null($response)) {
            return null;
        }
        // Parse and return the response
        return $this->parse_response($response, true, 'delete');
    }

Usage Example

 /**
  * Send a delete request.
  *
  * @since 0.2.0
  * @param string $url
  * @return object
  * @access private
  */
 private function send_delete_request($url)
 {
     return $this->request->delete($url);
 }