mirror of
https://code.castopod.org/adaures/castopod
synced 2025-05-13 09:45:47 +00:00

- update .devcontainer settings: remove auto-formatting for php + set intelephense as default formatter - remove prettier php plugin as it lacks php 8 support - add captain hook action for checking style pre-commit - fix style with ecs on all files except views
45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* This class defines a Paginated OrderedCollection based on CodeIgniter4 Pager to get the pagination metadata
|
|
*
|
|
* @copyright 2021 Podlibre
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
namespace ActivityPub\Objects;
|
|
|
|
use CodeIgniter\Pager\Pager;
|
|
|
|
class OrderedCollectionPage extends OrderedCollectionObject
|
|
{
|
|
protected string $type = 'OrderedCollectionPage';
|
|
|
|
protected string $partOf;
|
|
|
|
protected ?string $prev;
|
|
|
|
protected ?string $next;
|
|
|
|
public function __construct(Pager $pager, ?array $orderedItems = null)
|
|
{
|
|
parent::__construct($orderedItems, $pager);
|
|
|
|
$isFirstPage = $pager->getCurrentPage() === $pager->getFirstPage();
|
|
$isLastPage = $pager->getCurrentPage() === $pager->getLastPage();
|
|
if ($isFirstPage) {
|
|
$this->first = null;
|
|
}
|
|
if ($isLastPage) {
|
|
$this->last = null;
|
|
}
|
|
|
|
$this->id = $pager->getPageURI($pager->getCurrentPage());
|
|
$this->partOf = $pager->getPageURI();
|
|
$this->prev = $pager->getPreviousPageURI();
|
|
$this->current = $pager->getPageURI($pager->getCurrentPage());
|
|
$this->next = $pager->getNextPageURI();
|
|
}
|
|
}
|