public function fetchAll(ApiInterface $api, $method, array $parameters = [])
    {
        // get the perPage from the api
        $perPage = $api->getPerPage();

        // set parameters per_page to max to minimize number of requests
        $api->setPerPage(100);

        try {
            $result = $this->fetch($api, $method, $parameters)['values'];

            while ($this->hasNext()) {
                $next = $this->fetchNext();
                $result = array_merge($result, $next['values']);
            }
        } finally {
            // restore the perPage
            $api->setPerPage($perPage);
        }

        return $result;
    }
public function fetchAll(ApiInterface $api, $method, array $parameters = [])
    {
        // get the perPage from the api
        $perPage = $api->getPerPage();

        // set parameters per_page to max to minimize number of requests
        $api->setPerPage(100);

        try {
            $result = $this->fetch($api, $method, $parameters)['values'];

            while ($this->hasNext()) {
                $next = $this->fetchNext();
                $result = array_merge($result, $next['values']);
            }
        } finally {
            // restore the perPage
            $api->setPerPage($perPage);
        }

        return $result;
    }
public function fetchAll ( ApiInterface $ api , $ method , array $ parameters = [ ] ) { // get the perPage from the api $ perPage = $ api -> getPerPage ( ) ; // set parameters per_page to max to minimize number of requests $ api -> setPerPage ( 100 ) ; try { $ result = $ this -> fetch ( $ api , $ method , $ parameters ) [ 'values' ] ; while ( $ this -> hasNext ( ) ) { $ next = $ this -> fetchNext ( ) ; $ result = array_merge ( $ result , $ next [ 'values' ] ) ; } } finally { // restore the perPage $ api -> setPerPage ( $ perPage ) ; } return $ result ; }
Fetch all results from an api call.

@param \Bitbucket\Api\ApiInterface $api
@param string                      $method
@param array                       $parameters

@throws \Http\Client\Exception

@return array
Fetch all results from an api call .