public function get($endpoint, $params = [])
    {
        // build url
        $url = $this->domain . '/' . $endpoint;

        if (!empty($params)) {
            $url = $url . '?' . http_build_query($params);
        }

        $request = new Request($url);
        
        // Add client secret header
        if (isset($this->config['secret'])) {
            $request->headers->add(['X-Client-Secret' => $this->config['secret']]);
        }
        
        // add curl options
        if (isset($this->config['curl']) && is_array($this->config['curl'])) {
            foreach ($this->config['curl'] as $option => $value) {
                $request->setOption($option, $value);
            }
        }
        
        $request->execute();

        return $request->getResponse();
    }
public function get($endpoint, $params = [])
    {
        // build url
        $url = $this->domain . '/' . $endpoint;

        if (!empty($params)) {
            $url = $url . '?' . http_build_query($params);
        }

        $request = new Request($url);
        
        // Add client secret header
        if (isset($this->config['secret'])) {
            $request->headers->add(['X-Client-Secret' => $this->config['secret']]);
        }
        
        // add curl options
        if (isset($this->config['curl']) && is_array($this->config['curl'])) {
            foreach ($this->config['curl'] as $option => $value) {
                $request->setOption($option, $value);
            }
        }
        
        $request->execute();

        return $request->getResponse();
    }
public function get ( $ endpoint , $ params = [ ] ) { // build url $ url = $ this -> domain . '/' . $ endpoint ; if ( ! empty ( $ params ) ) { $ url = $ url . '?' . http_build_query ( $ params ) ; } $ request = new Request ( $ url ) ; // Add client secret header if ( isset ( $ this -> config [ 'secret' ] ) ) { $ request -> headers -> add ( [ 'X-Client-Secret' => $ this -> config [ 'secret' ] ] ) ; } // add curl options if ( isset ( $ this -> config [ 'curl' ] ) && is_array ( $ this -> config [ 'curl' ] ) ) { foreach ( $ this -> config [ 'curl' ] as $ option => $ value ) { $ request -> setOption ( $ option , $ value ) ; } } $ request -> execute ( ) ; return $ request -> getResponse ( ) ; }
Make a GET Request to an endpoint
@param       $endpoint
@param array $params
@return \Jyggen\Curl\Response
@throws \Jyggen\Curl\Exception\CurlErrorException
@throws \Jyggen\Curl\Exception\ProtectedOptionException
Make a GET Request to an endpoint