public function send($asArray = true)
    {
        $options = [];

        // query
        if (!empty($this->query)) {
            $options['query'] = $this->query;
        }

        // body
        if (!empty($this->body)) {
            $options['body'] = $this->body;
        }

        // ssl cert
        if ($this->sslCert && $this->sslKey) {
            $options['cert'] = $this->sslCert;
            $options['ssl_key'] = $this->sslKey;
        }

        $response = (new Client())->request($this->method, $this->uri, $options);
        $contents = $response->getBody()->getContents();

        if (!$asArray) {
            return $contents;
        }

        $array = Serializer::parse($contents);

        return new ArrayCollection($array);
    }
public function send($asArray = true)
    {
        $options = [];

        // query
        if (!empty($this->query)) {
            $options['query'] = $this->query;
        }

        // body
        if (!empty($this->body)) {
            $options['body'] = $this->body;
        }

        // ssl cert
        if ($this->sslCert && $this->sslKey) {
            $options['cert'] = $this->sslCert;
            $options['ssl_key'] = $this->sslKey;
        }

        $response = (new Client())->request($this->method, $this->uri, $options);
        $contents = $response->getBody()->getContents();

        if (!$asArray) {
            return $contents;
        }

        $array = Serializer::parse($contents);

        return new ArrayCollection($array);
    }
public function send ( $ asArray = true ) { $ options = [ ] ; // query if ( ! empty ( $ this -> query ) ) { $ options [ 'query' ] = $ this -> query ; } // body if ( ! empty ( $ this -> body ) ) { $ options [ 'body' ] = $ this -> body ; } // ssl cert if ( $ this -> sslCert && $ this -> sslKey ) { $ options [ 'cert' ] = $ this -> sslCert ; $ options [ 'ssl_key' ] = $ this -> sslKey ; } $ response = ( new Client ( ) ) -> request ( $ this -> method , $ this -> uri , $ options ) ; $ contents = $ response -> getBody ( ) -> getContents ( ) ; if ( ! $ asArray ) { return $ contents ; } $ array = Serializer :: parse ( $ contents ) ; return new ArrayCollection ( $ array ) ; }
Send Request.
Send Request .