private function run($path, $options)
    {
        $method  = $options['method'];
        $data    = isset($options['data'])    ? $options['data']    : null;
        $params  = isset($options['params'])  ? $options['params']  : null;
        $headers = isset($options['headers']) ? $options['headers'] : array();
        $body    = !empty($data)              ? json_encode($data)  : null;

        // Arrays in constants are in PHP 5.6+
        $allowedHeaders = array(
            'If-None-Match',    // Pairs with `ETag` response header.
            'If-Modified-Since' // Pairs with `Last-Modified` response header.
        );

        $headers = $this->filterOptions($headers, $allowedHeaders);
        $headers['User-Agent']   = $this->userAgent;
        $headers['Content-Type'] = 'application/json';

        if (!empty($headers['If-Modified-Since']) && $headers['If-Modified-Since'] instanceof DateTime) {
            $headers['If-Modified-Since'] = gmdate('D, d M Y H:i:s \G\M\T', $headers['If-Modified-Since']->getTimestamp());
        }

        $response = $this->requester->run(array(
            'url'     => self::URL . $this->slug . $path,
            'method'  => $method,
            'params'  => $params,
            'body'    => $body,
            'userpwd' => "$this->email:$this->apiKey",
            'headers' => $headers
        ));

        return $response;
    }
private function run($path, $options)
    {
        $method  = $options['method'];
        $data    = isset($options['data'])    ? $options['data']    : null;
        $params  = isset($options['params'])  ? $options['params']  : null;
        $headers = isset($options['headers']) ? $options['headers'] : array();
        $body    = !empty($data)              ? json_encode($data)  : null;

        // Arrays in constants are in PHP 5.6+
        $allowedHeaders = array(
            'If-None-Match',    // Pairs with `ETag` response header.
            'If-Modified-Since' // Pairs with `Last-Modified` response header.
        );

        $headers = $this->filterOptions($headers, $allowedHeaders);
        $headers['User-Agent']   = $this->userAgent;
        $headers['Content-Type'] = 'application/json';

        if (!empty($headers['If-Modified-Since']) && $headers['If-Modified-Since'] instanceof DateTime) {
            $headers['If-Modified-Since'] = gmdate('D, d M Y H:i:s \G\M\T', $headers['If-Modified-Since']->getTimestamp());
        }

        $response = $this->requester->run(array(
            'url'     => self::URL . $this->slug . $path,
            'method'  => $method,
            'params'  => $params,
            'body'    => $body,
            'userpwd' => "$this->email:$this->apiKey",
            'headers' => $headers
        ));

        return $response;
    }
private function run ( $ path , $ options ) { $ method = $ options [ 'method' ] ; $ data = isset ( $ options [ 'data' ] ) ? $ options [ 'data' ] : null ; $ params = isset ( $ options [ 'params' ] ) ? $ options [ 'params' ] : null ; $ headers = isset ( $ options [ 'headers' ] ) ? $ options [ 'headers' ] : array ( ) ; $ body = ! empty ( $ data ) ? json_encode ( $ data ) : null ; // Arrays in constants are in PHP 5.6+ $ allowedHeaders = array ( 'If-None-Match' , // Pairs with `ETag` response header. 'If-Modified-Since' // Pairs with `Last-Modified` response header. ) ; $ headers = $ this -> filterOptions ( $ headers , $ allowedHeaders ) ; $ headers [ 'User-Agent' ] = $ this -> userAgent ; $ headers [ 'Content-Type' ] = 'application/json' ; if ( ! empty ( $ headers [ 'If-Modified-Since' ] ) && $ headers [ 'If-Modified-Since' ] instanceof DateTime ) { $ headers [ 'If-Modified-Since' ] = gmdate ( 'D, d M Y H:i:s \G\M\T' , $ headers [ 'If-Modified-Since' ] -> getTimestamp ( ) ) ; } $ response = $ this -> requester -> run ( array ( 'url' => self :: URL . $ this -> slug . $ path , 'method' => $ method , 'params' => $ params , 'body' => $ body , 'userpwd' => "$this->email:$this->apiKey" , 'headers' => $ headers ) ) ; return $ response ; }
Execute HTTP method on path with data
Execute HTTP method on path with data