static public function bearerRequest($method, $url, $token = null, $data = null)
    {
        $options = [
            'headers' => [
                'User-Agent' => self::USER_AGENT_PREFIX . \Pmp\Sdk::VERSION,
                'Accept' => self::CONTENT_TYPE,
                'Content-Type' => self::CONTENT_TYPE,
            ]
        ];

        if (self::$optGzip) {
            $options['headers']['Accept-Encoding'] = 'gzip,deflate';
        }
        if ($token) {
            $options['headers']['Authorization'] = "Bearer $token";
        }
        if ((strtolower($method) == 'post' || strtolower($method) == 'put') && !empty($data)) {
            $options['body'] = json_encode($data);
        }

        // preferences - only agree to minimal responses for non-home-docs
        $path = parse_url($url, PHP_URL_PATH);
        if (self::$optMinimal && !empty($path)) {
            $options['headers']['Prefer'] = 'return=minimal';
        }

        return self::_sendRequest($method, $url, $options);
    }
static public function bearerRequest($method, $url, $token = null, $data = null)
    {
        $options = [
            'headers' => [
                'User-Agent' => self::USER_AGENT_PREFIX . \Pmp\Sdk::VERSION,
                'Accept' => self::CONTENT_TYPE,
                'Content-Type' => self::CONTENT_TYPE,
            ]
        ];

        if (self::$optGzip) {
            $options['headers']['Accept-Encoding'] = 'gzip,deflate';
        }
        if ($token) {
            $options['headers']['Authorization'] = "Bearer $token";
        }
        if ((strtolower($method) == 'post' || strtolower($method) == 'put') && !empty($data)) {
            $options['body'] = json_encode($data);
        }

        // preferences - only agree to minimal responses for non-home-docs
        $path = parse_url($url, PHP_URL_PATH);
        if (self::$optMinimal && !empty($path)) {
            $options['headers']['Prefer'] = 'return=minimal';
        }

        return self::_sendRequest($method, $url, $options);
    }
static public function bearerRequest ( $ method , $ url , $ token = null , $ data = null ) { $ options = [ 'headers' => [ 'User-Agent' => self :: USER_AGENT_PREFIX . \ Pmp \ Sdk :: VERSION , 'Accept' => self :: CONTENT_TYPE , 'Content-Type' => self :: CONTENT_TYPE , ] ] ; if ( self :: $ optGzip ) { $ options [ 'headers' ] [ 'Accept-Encoding' ] = 'gzip,deflate' ; } if ( $ token ) { $ options [ 'headers' ] [ 'Authorization' ] = "Bearer $token" ; } if ( ( strtolower ( $ method ) == 'post' || strtolower ( $ method ) == 'put' ) && ! empty ( $ data ) ) { $ options [ 'body' ] = json_encode ( $ data ) ; } // preferences - only agree to minimal responses for non-home-docs $ path = parse_url ( $ url , PHP_URL_PATH ) ; if ( self :: $ optMinimal && ! empty ( $ path ) ) { $ options [ 'headers' ] [ 'Prefer' ] = 'return=minimal' ; } return self :: _sendRequest ( $ method , $ url , $ options ) ; }
Make a request using bearer token authentication

@param string $method the HTTP method
@param string $url the absolute location
@param string $token the auth token
@param array $data body data
@return array the response status and body as array(int $status, \StdClass $body, array $rawResponseData)
Make a request using bearer token authentication