src/Api.php
private function prepareRequestArguments(array $data = null, string $method = null): array
    {
        $data   = $data ?? [];
        $method = $method ?? 'GET';

        // Removes null entries.
        $data = array_filter($data, function ($val) {
            return (null !== $val);
        });

        $headers = [
            'Content-Type' => 'application/json',
            'X-Auth-Email' => $this->email,
            'X-Auth-Key'   => $this->auth_key,
        ];

        $args = [
            'body'    => wp_json_encode($data),
            'headers' => $headers,
            'method'  => strtoupper($method),
            'timeout' => 15,
        ];

        return $args;
    }
private function prepareRequestArguments(array $data = null, string $method = null): array
    {
        $data   = $data ?? [];
        $method = $method ?? 'GET';

        // Removes null entries.
        $data = array_filter($data, function ($val) {
            return (null !== $val);
        });

        $headers = [
            'Content-Type' => 'application/json',
            'X-Auth-Email' => $this->email,
            'X-Auth-Key'   => $this->auth_key,
        ];

        $args = [
            'body'    => wp_json_encode($data),
            'headers' => $headers,
            'method'  => strtoupper($method),
            'timeout' => 15,
        ];

        return $args;
    }
private function prepareRequestArguments ( array $ data = null , string $ method = null ) : array { $ data = $ data ?? [ ] ; $ method = $ method ?? 'GET' ; // Removes null entries. $ data = array_filter ( $ data , function ( $ val ) { return ( null !== $ val ) ; } ) ; $ headers = [ 'Content-Type' => 'application/json' , 'X-Auth-Email' => $ this -> email , 'X-Auth-Key' => $ this -> auth_key , ] ; $ args = [ 'body' => wp_json_encode ( $ data ) , 'headers' => $ headers , 'method' => strtoupper ( $ method ) , 'timeout' => 15 , ] ; return $ args ; }
Prepare arguments for wp_remote_request.

@param array|null  $data   Data to be sent along with the request.
@param string|null $method Type of method that should be used ('GET', 'POST', 'PUT', 'DELETE', 'PATCH').

@return array
Prepare arguments for wp_remote_request .