src/Yandex/Metrica/MetricaClient.php
protected function getNextPartOfList($url, $data = [])
    {
        $response = $this->sendRequest(
            'GET',
            $url,
            [
                'headers' => [
                    'Accept' => 'application/x-yametrika+json',
                    'Content-Type' => 'application/x-yametrika+json',
                    'Authorization' => 'OAuth ' . $this->getAccessToken(),
                ]
            ]
        );

        $decodedResponseBody = $this->getDecodedBody($response->getBody());

        $mergedDecodedResponseBody = array_merge_recursive($data, $decodedResponseBody);

        if (isset($mergedDecodedResponseBody['links']) && isset($mergedDecodedResponseBody['links']['next'])) {
            $url = $mergedDecodedResponseBody['links'];
            unset($mergedDecodedResponseBody['rows']);
            unset($mergedDecodedResponseBody['links']);
            return $this->getNextPartOfList($url, $response);
        }

        return $mergedDecodedResponseBody;
    }
protected function getNextPartOfList($url, $data = [])
    {
        $response = $this->sendRequest(
            'GET',
            $url,
            [
                'headers' => [
                    'Accept' => 'application/x-yametrika+json',
                    'Content-Type' => 'application/x-yametrika+json',
                    'Authorization' => 'OAuth ' . $this->getAccessToken(),
                ]
            ]
        );

        $decodedResponseBody = $this->getDecodedBody($response->getBody());

        $mergedDecodedResponseBody = array_merge_recursive($data, $decodedResponseBody);

        if (isset($mergedDecodedResponseBody['links']) && isset($mergedDecodedResponseBody['links']['next'])) {
            $url = $mergedDecodedResponseBody['links'];
            unset($mergedDecodedResponseBody['rows']);
            unset($mergedDecodedResponseBody['links']);
            return $this->getNextPartOfList($url, $response);
        }

        return $mergedDecodedResponseBody;
    }
protected function getNextPartOfList ( $ url , $ data = [ ] ) { $ response = $ this -> sendRequest ( 'GET' , $ url , [ 'headers' => [ 'Accept' => 'application/x-yametrika+json' , 'Content-Type' => 'application/x-yametrika+json' , 'Authorization' => 'OAuth ' . $ this -> getAccessToken ( ) , ] ] ) ; $ decodedResponseBody = $ this -> getDecodedBody ( $ response -> getBody ( ) ) ; $ mergedDecodedResponseBody = array_merge_recursive ( $ data , $ decodedResponseBody ) ; if ( isset ( $ mergedDecodedResponseBody [ 'links' ] ) && isset ( $ mergedDecodedResponseBody [ 'links' ] [ 'next' ] ) ) { $ url = $ mergedDecodedResponseBody [ 'links' ] ; unset ( $ mergedDecodedResponseBody [ 'rows' ] ) ; unset ( $ mergedDecodedResponseBody [ 'links' ] ) ; return $ this -> getNextPartOfList ( $ url , $ response ) ; } return $ mergedDecodedResponseBody ; }
Send custom GET request to API resource

@param string $url
@param array $data
@return array
Send custom GET request to API resource