"Fossies" - the Fresh Open Source Software Archive

Member "grav/system/src/Grav/Framework/Pagination/AbstractPaginationPage.php" (8 Jun 2020, 1187 Bytes) of package /linux/www/grav-v1.6.26.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "AbstractPaginationPage.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 /**
    4  * @package    Grav\Framework\Pagination
    5  *
    6  * @copyright  Copyright (C) 2015 - 2019 Trilby Media, LLC. All rights reserved.
    7  * @license    MIT License; see LICENSE file for details.
    8  */
    9 
   10 namespace Grav\Framework\Pagination;
   11 
   12 use Grav\Framework\Pagination\Interfaces\PaginationPageInterface;
   13 
   14 abstract class AbstractPaginationPage implements PaginationPageInterface
   15 {
   16     /** @var array */
   17     protected $options;
   18 
   19     public function isActive(): bool
   20     {
   21         return $this->options['active'] ?? false;
   22     }
   23 
   24     public function isEnabled(): bool
   25     {
   26         return $this->options['enabled'] ?? false;
   27     }
   28 
   29     public function getOptions(): array
   30     {
   31         return $this->options ?? [];
   32     }
   33 
   34     public function getNumber(): ?int
   35     {
   36         return $this->options['number'] ?? null;
   37     }
   38 
   39     public function getLabel(): string
   40     {
   41         return $this->options['label'] ?? (string)$this->getNumber();
   42     }
   43 
   44     public function getUrl(): ?string
   45     {
   46         return $this->options['route'] ? (string)$this->options['route']->getUri() : null;
   47     }
   48 
   49     protected function setOptions(array $options): void
   50     {
   51         $this->options = $options;
   52     }
   53 }