public function controlPagedResultResponse($result, &$cookie);
/** * Paginates the current LDAP query. * * @param int $perPage * @param int $currentPage * @param bool $isCritical * * @return Paginator|bool */ public function paginate($perPage = 50, $currentPage = 0, $isCritical = true) { $this->paginated = true; $pages = []; $cookie = ''; do { $this->connection->controlPagedResult($perPage, $isCritical, $cookie); // Run the search. $resource = $this->connection->search($this->getDn(), $this->getQuery(), $this->getSelects()); if ($resource) { $this->connection->controlPagedResultResponse($resource, $cookie); // We'll collect each resource result into the pages array. $pages[] = $resource; } } while (!empty($cookie)); $paginator = $this->newProcessor()->processPaginated($pages, $perPage, $currentPage); // Reset paged result on the current connection. We won't pass in the current $perPage // parameter since we want to reset the page size to the default '1000'. Sending '0' // eliminates any further opportunity for running queries in the same request, // even though that is supposed to be the correct usage. $this->connection->controlPagedResult(); return $paginator; }