Creates the page collection.

@param  string $scrollingStyle Scrolling style
@return array
972158
protected function _createPages($scrollingStyle = null)
    {
        $pageCount         = $this->count();
        $currentPageNumber = $this->getCurrentPageNumber();

        $pages = array(
            'pageCount'         => $pageCount,
            'itemCountPerPage'  => $this->getItemCountPerPage(),
            'first'             => 1,
            'current'           => $currentPageNumber,
            'last'              => $pageCount
        );

        // Previous and next
        if ($currentPageNumber - 1 > 0) {
            $pages['previous'] = $currentPageNumber - 1;
        }

        if ($currentPageNumber + 1 <= $pageCount) {
            $pages['next'] = $currentPageNumber + 1;
        }

        // Pages in range
        $scrollingStyle = $this->_loadScrollingStyle($scrollingStyle);
        $pages['pagesInRange']     = $scrollingStyle->getPages($this);
        $pages['firstPageInRange'] = min($pages['pagesInRange']);
        $pages['lastPageInRange']  = max($pages['pagesInRange']);


        return $pages;
    }
718200
@Override
	public PageSection build() {
		final PageSectionStyle style = new PageSectionStyle(this.marginsBuilder.build(),
				this.minHeight);
		final PageSectionContent header = new SimpleFooterHeader(
				this.curRegionBox.get());
		return new PageSection(header, style);
	}
410339
protected function getCollection()
    {
        $collection = [];

        $class = $this->getCollectionClassName();
        if ($class) {
            /** @var Collection $collection */
            $collection = new $class();
            $collection->setModel($this->class);
            $collection->setFormatter($this);
        }

        return $collection;
    }
684161
protected function _collection()
    {
        if (!isset($this->_collections[$this->_collection])) {
            $this->_collections[$this->_collection] = new $this->_collectionClass($this);
        }

        return $this->_collections[$this->_collection];
    }
1289780
public function search($query)
    {
        $criteria = [];
        foreach ($query as $term) {
            $criteria[$term->name] = $term->toparam();
        }
        $pager = [
            'object' => $this,
            'method' => 'fetchDisputes',
            'query' => $criteria
        ];
        return new PaginatedCollection($pager);
    }
801919
public function collection($collection, $wrap = true)
    {
        $collection = $this->database->selectCollection($collection);
        $wrap && $collection = new Collection($collection);

        return $collection;
    }
723636
public function getCollectionSize()
    {
        $size = 0;
        foreach ($this->pageList as $page) {
            $size += $page->getPageElementCount();
        }
        return $size;
    }
11186
private function getSuggestCollection()
    {
        $queryCollection = $this->queryFactory->get()->getSuggestCollection();
        $queryCollection->addFieldToFilter('is_spellchecked', 'false')->setPageSize($this->getResultsPageSize());

        return $queryCollection;
    }
123654
private static function createArticles(Collection $items) : Collection
    {
        return $items->map(function ($item) {
            return Article::create($item);
        })->filter()->sort(function ($first, $second) {
            if ($first->timestamp === $second->timestamp) {
                return strnatcmp($first->title, $second->title);
            } else {
                return $first->timestamp < $second->timestamp ? -1 : 1;
            }
        })->map(function (Article $article, $key) {
            $article->setId($key);
            return $article;
        });
    }
971683
public function getHeaderCollection()
    {
        if ($this->_headerCollection === null) {
            $headerCollection = new HeaderCollection();
            $headerCollection->fromArray($this->defaultHeaders());
            $this->_headerCollection = $headerCollection;
        }
        return $this->_headerCollection;
    }
419140
public function newAction()
    {
        $entity = new Collection();
        $form = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
1225097
protected function getOrCreateCollection($title)
    {
        if (isset($this->collectionFirstLevelCache[$title])) {
            return $this->collectionFirstLevelCache[$title];
        }

        $collection = $this->collectionRepository->findOneByTitle($title);

        if ($collection === null) {
            $collection = new AssetCollection($title);
            $this->collectionRepository->add($collection);
        }

        $this->collectionFirstLevelCache[$title] = $collection;

        return $collection;
    }
367268
public function collection($params = 'content', $pagination = true)
    {
        if (is_string($params)) {
            $params = (array)$this->value('header.' . $params);
        } elseif (!is_array($params)) {
            throw new \InvalidArgumentException('Argument should be either header variable name or array of parameters');
        }

        if (!isset($params['items'])) {
            return new Collection();
        }

        // See if require published filter is set and use that, if assume published=true
        $only_published = true;
        if (isset($params['filter']['published']) && $params['filter']['published']) {
            $only_published = false;
        } elseif (isset($params['filter']['non-published']) && $params['filter']['non-published']) {
            $only_published = false;
        }

        $collection = $this->evaluate($params['items'], $only_published);
        if (!$collection instanceof Collection) {
            $collection = new Collection();
        }
        $collection->setParams($params);

        /** @var Uri $uri */
        $uri = Grav::instance()['uri'];
        /** @var Config $config */
        $config = Grav::instance()['config'];

        $process_taxonomy = $params['url_taxonomy_filters'] ?? $config->get('system.pages.url_taxonomy_filters');

        if ($process_taxonomy) {
            foreach ((array)$config->get('site.taxonomies') as $taxonomy) {
                if ($uri->param(rawurlencode($taxonomy))) {
                    $items = explode(',', $uri->param($taxonomy));
                    $collection->setParams(['taxonomies' => [$taxonomy => $items]]);

                    foreach ($collection as $page) {
                        // Don't filter modular pages
                        if ($page->modular()) {
                            continue;
                        }
                        foreach ($items as $item) {
                            $item = rawurldecode($item);
                            if (empty($page->taxonomy[$taxonomy]) || !\in_array(htmlspecialchars_decode($item, ENT_QUOTES), $page->taxonomy[$taxonomy], true)
                            ) {
                                $collection->remove($page->path());
                            }
                        }
                    }
                }
            }
        }

        // If  a filter or filters are set, filter the collection...
        if (isset($params['filter'])) {

            // remove any inclusive sets from filer:
            $sets = ['published', 'visible', 'modular', 'routable'];
            foreach ($sets as $type) {
                $var = "non-{$type}";
                if (isset($params['filter'][$type], $params['filter'][$var]) && $params['filter'][$type] && $params['filter'][$var]) {
                    unset ($params['filter'][$type], $params['filter'][$var]);
                }
            }

            foreach ((array)$params['filter'] as $type => $filter) {
                switch ($type) {
                    case 'published':
                        if ((bool) $filter) {
                            $collection->published();
                        }
                        break;
                    case 'non-published':
                        if ((bool) $filter) {
                            $collection->nonPublished();
                        }
                        break;
                    case 'visible':
                        if ((bool) $filter) {
                            $collection->visible();
                        }
                        break;
                    case 'non-visible':
                        if ((bool) $filter) {
                            $collection->nonVisible();
                        }
                        break;
                    case 'modular':
                        if ((bool) $filter) {
                            $collection->modular();
                        }
                        break;
                    case 'non-modular':
                        if ((bool) $filter) {
                            $collection->nonModular();
                        }
                        break;
                    case 'routable':
                        if ((bool) $filter) {
                            $collection->routable();
                        }
                        break;
                    case 'non-routable':
                        if ((bool) $filter) {
                            $collection->nonRoutable();
                        }
                        break;
                    case 'type':
                        $collection->ofType($filter);
                        break;
                    case 'types':
                        $collection->ofOneOfTheseTypes($filter);
                        break;
                    case 'access':
                        $collection->ofOneOfTheseAccessLevels($filter);
                        break;
                }
            }
        }

        if (isset($params['dateRange'])) {
            $start = $params['dateRange']['start'] ?? 0;
            $end = $params['dateRange']['end'] ?? false;
            $field = $params['dateRange']['field'] ?? false;
            $collection->dateRange($start, $end, $field);
        }

        if (isset($params['order'])) {
            $by = $params['order']['by'] ?? 'default';
            $dir = $params['order']['dir'] ?? 'asc';
            $custom = $params['order']['custom'] ?? null;
            $sort_flags = $params['order']['sort_flags'] ?? null;

            if (is_array($sort_flags)) {
                $sort_flags = array_map('constant', $sort_flags); //transform strings to constant value
                $sort_flags = array_reduce($sort_flags, function ($a, $b) {
                    return $a | $b;
                }, 0); //merge constant values using bit or
            }

            $collection->order($by, $dir, $custom, $sort_flags);
        }

        /** @var Grav $grav */
        $grav = Grav::instance();

        // New Custom event to handle things like pagination.
        $grav->fireEvent('onCollectionProcessed', new Event(['collection' => $collection]));

        // Slice and dice the collection if pagination is required
        if ($pagination) {
            $params = $collection->params();

            $limit = $params['limit'] ?? 0;
            $start = !empty($params['pagination']) ? ($uri->currentPage() - 1) * $limit : 0;

            if ($limit && $collection->count() > $limit) {
                $collection->slice($start, $limit);
            }
        }

        return $collection;
    }
116010
public function getStyles()
	{
		$list	= array();
		$query	= "//style";
		$tags	= $this->getTagsByXPath( $query );
		foreach( $tags as $tag )
			$list[]	= $tag->textContent;
		return $list;
	}
956743
public function get($scroll_id = NULL)
    {

        $scroll_id = NULL;

        $result = $this->getResult($scroll_id);

        return $this->getAll($result);
    }
225266
public function createCollection(LoggerInterface $logger, string $buildFolder) : WriterCollection
    {
        $writerCollection = new WriterCollection();
        $propertyHolder   = new PropertyHolder();

        $fullFilter = new FullFilter($propertyHolder);
        $stdFilter  = new StandardFilter($propertyHolder);
        $liteFilter = new LiteFilter($propertyHolder);

        $formatter = new PhpFormatter($propertyHolder);

        $fullPhpWriter = new IniWriter($buildFolder . '/full_php_browscap.ini', $logger);
        $fullPhpWriter->setFormatter($formatter);
        $fullPhpWriter->setFilter($fullFilter);
        $writerCollection->addWriter($fullPhpWriter);

        $stdPhpWriter = new IniWriter($buildFolder . '/php_browscap.ini', $logger);
        $stdPhpWriter->setFormatter($formatter);
        $stdPhpWriter->setFilter($stdFilter);
        $writerCollection->addWriter($stdPhpWriter);

        $litePhpWriter = new IniWriter($buildFolder . '/lite_php_browscap.ini', $logger);
        $litePhpWriter->setFormatter($formatter);
        $litePhpWriter->setFilter($liteFilter);
        $writerCollection->addWriter($litePhpWriter);

        return $writerCollection;
    }
225447
public function createRouteCollection()
    {
        $routeCollection  = $this->createNew(RouteCollection::class);

        $routeCollection->addRoute('GET', '/{resourceNamePlural}', [$this, 'callGetResources']);
        $routeCollection->addRoute('POST', '/{resourceNamePlural}', [$this, 'callCreateNewResource']);
        $routeCollection->addRoute('PUT', '/{resourceNamePlural}', [$this, 'callCreateNewResource']);
        $routeCollection->addRoute('HEAD', '/{resourceNamePlural}', [$this, 'callMethodNotAllowed']);
        $routeCollection->addRoute('DEL', '/{resourceNamePlural}', [$this, 'callMethodNotAllowed']);

        $routeCollection->addRoute('GET', '/{resourceNamePlural}/{id}', [$this, 'callGetResource']);
        $routeCollection->addRoute('POST', '/{resourceNamePlural}/{id}', [$this, 'callEditResource']);
        $routeCollection->addRoute('PUT', '/{resourceNamePlural}/{id}', [$this, 'callEditResource']);
        $routeCollection->addRoute('HEAD', '/{resourceNamePlural}/{id}', [$this, 'callResourceExists']);
        $routeCollection->addRoute('DEL', '/{resourceNamePlural}/{id}', [$this, 'calldDeleteResource']);

        $routeCollection->addRoute('GET', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callGetChildResources']);
        $routeCollection->addRoute('POST', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callCreateNewChildResource']);
        $routeCollection->addRoute('PUT', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callCreateNewChildResource']);
        $routeCollection->addRoute('HEAD', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callMethodNotAllowed']);
        $routeCollection->addRoute('DEL', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callMethodNotAllowed']);

        return $routeCollection;
    }