public function fetch($result, $valuesKey = 'values')
    {
        if ('1.0' === $this->client->getApiVersion()) {
            return $this->fetchApi1($result, $valuesKey);
        }

        /** @var Request $request */
        $request = $this->client->getLastRequest();

        if (!array_key_exists('values', $result)) {
            throw new \RuntimeException(
                sprintf(
                    'No values-key "values" found in resource "%s", please report this bug to the Gush developers.',
                    $request->getResource()
                )
            );
        }

        $fullResult = $result['values'];

        // BitBucket please fix your API..
        // https://bitbucket.org/site/master/issue/9659/pagelen-sometimes-limited-to-100
        // Luckily we only need one extra request
        if (null !== $this->perPage && $this->perPage > 50 && isset($result['next']) && false !== strpos($request->getResource(), '/pullrequests')) {
            $response = $this->client->get($result['next']);
            $result = json_decode($response->getContent(), true);
            $fullResult = array_merge($fullResult, $result['values']);
        }

        // Adapter maximum is 100, which is also the maximum of BitBucket's API
        if (null === $this->perPage) {
            while (isset($result['next'])) {
                $response = $this->client->get($result['next']);
                $result = json_decode($response->getContent(), true);
                $fullResult = array_merge($fullResult, $result['values']);
            }
        }

        return $fullResult;
    }
public function fetch($result, $valuesKey = 'values')
    {
        if ('1.0' === $this->client->getApiVersion()) {
            return $this->fetchApi1($result, $valuesKey);
        }

        /** @var Request $request */
        $request = $this->client->getLastRequest();

        if (!array_key_exists('values', $result)) {
            throw new \RuntimeException(
                sprintf(
                    'No values-key "values" found in resource "%s", please report this bug to the Gush developers.',
                    $request->getResource()
                )
            );
        }

        $fullResult = $result['values'];

        // BitBucket please fix your API..
        // https://bitbucket.org/site/master/issue/9659/pagelen-sometimes-limited-to-100
        // Luckily we only need one extra request
        if (null !== $this->perPage && $this->perPage > 50 && isset($result['next']) && false !== strpos($request->getResource(), '/pullrequests')) {
            $response = $this->client->get($result['next']);
            $result = json_decode($response->getContent(), true);
            $fullResult = array_merge($fullResult, $result['values']);
        }

        // Adapter maximum is 100, which is also the maximum of BitBucket's API
        if (null === $this->perPage) {
            while (isset($result['next'])) {
                $response = $this->client->get($result['next']);
                $result = json_decode($response->getContent(), true);
                $fullResult = array_merge($fullResult, $result['values']);
            }
        }

        return $fullResult;
    }
public function fetch ( $ result , $ valuesKey = 'values' ) { if ( '1.0' === $ this -> client -> getApiVersion ( ) ) { return $ this -> fetchApi1 ( $ result , $ valuesKey ) ; } /** @var Request $request */ $ request = $ this -> client -> getLastRequest ( ) ; if ( ! array_key_exists ( 'values' , $ result ) ) { throw new \ RuntimeException ( sprintf ( 'No values-key "values" found in resource "%s", please report this bug to the Gush developers.' , $ request -> getResource ( ) ) ) ; } $ fullResult = $ result [ 'values' ] ; // BitBucket please fix your API.. // https://bitbucket.org/site/master/issue/9659/pagelen-sometimes-limited-to-100 // Luckily we only need one extra request if ( null !== $ this -> perPage && $ this -> perPage > 50 && isset ( $ result [ 'next' ] ) && false !== strpos ( $ request -> getResource ( ) , '/pullrequests' ) ) { $ response = $ this -> client -> get ( $ result [ 'next' ] ) ; $ result = json_decode ( $ response -> getContent ( ) , true ) ; $ fullResult = array_merge ( $ fullResult , $ result [ 'values' ] ) ; } // Adapter maximum is 100, which is also the maximum of BitBucket's API if ( null === $ this -> perPage ) { while ( isset ( $ result [ 'next' ] ) ) { $ response = $ this -> client -> get ( $ result [ 'next' ] ) ; $ result = json_decode ( $ response -> getContent ( ) , true ) ; $ fullResult = array_merge ( $ fullResult , $ result [ 'values' ] ) ; } } return $ fullResult ; }
Fetches all the results.

@param array  $result
@param string $valuesKey

@return array

@throws \RuntimeException
Fetches all the results .