private function listEntitiesWithCps(PagerInterface $pager = null, array $query_params = [], string $key_provider = 'id'): array
    {
        $query_params = [
                'expand' => 'true',
            ] + $query_params;

        if ($pager) {
            $responseArray = $this->getResultsInRange($pager, $query_params);
            // Ignore entity type key from response, ex.: developer,
            // apiproduct, etc.
            $responseArray = reset($responseArray);

            return $this->responseArrayToArrayOfEntities($responseArray, $key_provider);
        } else {
            // Pass an empty pager to load all entities.
            $responseArray = $this->getResultsInRange($this->createPager(), $query_params);
            // Ignore entity type key from response, ex.: developer, apiproduct,
            // etc.
            $responseArray = reset($responseArray);
            if (empty($responseArray)) {
                return [];
            }
            $entities = $this->responseArrayToArrayOfEntities($responseArray, $key_provider);
            $lastEntity = end($entities);
            $lastId = $lastEntity->{$key_provider}();
            do {
                $tmp = $this->getResultsInRange($this->createPager(0, $lastId), $query_params);
                // Ignore entity type key from response, ex.: developer,
                // apiproduct, etc.
                $tmp = reset($tmp);
                // Remove the first item from the list because it is the same
                // as the last item of $entities at this moment.
                // Apigee Edge response always starts with the requested entity
                // (startKey).
                array_shift($tmp);
                $tmpEntities = $this->responseArrayToArrayOfEntities($tmp, $key_provider);

                if (count($tmpEntities) > 0) {
                    // The returned entity array is keyed by entity id which
                    // is unique so we can do this.
                    $entities += $tmpEntities;
                    $lastEntity = end($tmpEntities);
                    $lastId = $lastEntity->{$key_provider}();
                } else {
                    $lastId = false;
                }
            } while ($lastId);

            return $entities;
        }
    }
private function listEntitiesWithCps(PagerInterface $pager = null, array $query_params = [], string $key_provider = 'id'): array
    {
        $query_params = [
                'expand' => 'true',
            ] + $query_params;

        if ($pager) {
            $responseArray = $this->getResultsInRange($pager, $query_params);
            // Ignore entity type key from response, ex.: developer,
            // apiproduct, etc.
            $responseArray = reset($responseArray);

            return $this->responseArrayToArrayOfEntities($responseArray, $key_provider);
        } else {
            // Pass an empty pager to load all entities.
            $responseArray = $this->getResultsInRange($this->createPager(), $query_params);
            // Ignore entity type key from response, ex.: developer, apiproduct,
            // etc.
            $responseArray = reset($responseArray);
            if (empty($responseArray)) {
                return [];
            }
            $entities = $this->responseArrayToArrayOfEntities($responseArray, $key_provider);
            $lastEntity = end($entities);
            $lastId = $lastEntity->{$key_provider}();
            do {
                $tmp = $this->getResultsInRange($this->createPager(0, $lastId), $query_params);
                // Ignore entity type key from response, ex.: developer,
                // apiproduct, etc.
                $tmp = reset($tmp);
                // Remove the first item from the list because it is the same
                // as the last item of $entities at this moment.
                // Apigee Edge response always starts with the requested entity
                // (startKey).
                array_shift($tmp);
                $tmpEntities = $this->responseArrayToArrayOfEntities($tmp, $key_provider);

                if (count($tmpEntities) > 0) {
                    // The returned entity array is keyed by entity id which
                    // is unique so we can do this.
                    $entities += $tmpEntities;
                    $lastEntity = end($tmpEntities);
                    $lastId = $lastEntity->{$key_provider}();
                } else {
                    $lastId = false;
                }
            } while ($lastId);

            return $entities;
        }
    }
private function listEntitiesWithCps ( PagerInterface $ pager = null , array $ query_params = [ ] , string $ key_provider = 'id' ) : array { $ query_params = [ 'expand' => 'true' , ] + $ query_params ; if ( $ pager ) { $ responseArray = $ this -> getResultsInRange ( $ pager , $ query_params ) ; // Ignore entity type key from response, ex.: developer, // apiproduct, etc. $ responseArray = reset ( $ responseArray ) ; return $ this -> responseArrayToArrayOfEntities ( $ responseArray , $ key_provider ) ; } else { // Pass an empty pager to load all entities. $ responseArray = $ this -> getResultsInRange ( $ this -> createPager ( ) , $ query_params ) ; // Ignore entity type key from response, ex.: developer, apiproduct, // etc. $ responseArray = reset ( $ responseArray ) ; if ( empty ( $ responseArray ) ) { return [ ] ; } $ entities = $ this -> responseArrayToArrayOfEntities ( $ responseArray , $ key_provider ) ; $ lastEntity = end ( $ entities ) ; $ lastId = $ lastEntity -> { $ key_provider } ( ) ; do { $ tmp = $ this -> getResultsInRange ( $ this -> createPager ( 0 , $ lastId ) , $ query_params ) ; // Ignore entity type key from response, ex.: developer, // apiproduct, etc. $ tmp = reset ( $ tmp ) ; // Remove the first item from the list because it is the same // as the last item of $entities at this moment. // Apigee Edge response always starts with the requested entity // (startKey). array_shift ( $ tmp ) ; $ tmpEntities = $ this -> responseArrayToArrayOfEntities ( $ tmp , $ key_provider ) ; if ( count ( $ tmpEntities ) > 0 ) { // The returned entity array is keyed by entity id which // is unique so we can do this. $ entities += $ tmpEntities ; $ lastEntity = end ( $ tmpEntities ) ; $ lastId = $ lastEntity -> { $ key_provider } ( ) ; } else { $ lastId = false ; } } while ( $ lastId ) ; return $ entities ; } }
Real paginated entity listing on organization with CPS support.

@param \Apigee\Edge\Structure\PagerInterface|null $pager
Pager.
@param array $query_params
Additional query parameters.
@param string $key_provider
Getter method on the entity that should provide a unique array key.

@return \Apigee\Edge\Entity\EntityInterface[]
Array of entity objects.

@psalm-suppress PossiblyNullArrayOffset $tmp->id() is always not null here.
Real paginated entity listing on organization with CPS support .