SeatGeek\Sixpack\Session\Base::sendRequest PHP Метод

sendRequest() защищенный Метод

Send the request to sixpack
protected sendRequest ( string $endpoint, array $params = [] ) : array
$endpoint string api end point
$params array
Результат array
    protected function sendRequest($endpoint, $params = array())
    {
        if (isset($params["experiment"]) && !preg_match('#^[a-z0-9][a-z0-9\\-_ ]*$#i', $params["experiment"])) {
            throw new InvalidExperimentNameException($params["experiment"]);
        }
        $params = array_merge(array('client_id' => $this->clientId, 'ip_address' => $this->getIpAddress(), 'user_agent' => $this->getUserAgent()), $params);
        $url = $this->baseUrl . '/' . $endpoint;
        $params = preg_replace('/%5B(?:[0-9]+)%5D=/', '=', http_build_query($params));
        $url .= '?' . $params;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->timeout);
        // Make sub 1 sec timeouts work, according to: http://ravidhavlesha.wordpress.com/2012/01/08/curl-timeout-problem-and-solution/
        curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
        $return = curl_exec($ch);
        $meta = curl_getinfo($ch);
        // handle failures in call dispatcher
        return array($return, $meta);
    }