mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-14 12:07:46 +02:00
refactor(modules): extract castopod parts into a modules/ folder for a scalable HMVC structure
- create Admin, Analytics, Auth, Fediverse and Install modules in the root modules/ folder - rename ActivityPub to Fediverse
This commit is contained in:
parent
94872f2338
commit
5083cd2fda
268 changed files with 4221 additions and 2186 deletions
50
modules/Fediverse/Objects/OrderedCollectionObject.php
Normal file
50
modules/Fediverse/Objects/OrderedCollectionObject.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* 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 Modules\Fediverse\Objects;
|
||||
|
||||
use CodeIgniter\Pager\Pager;
|
||||
use Modules\Fediverse\Core\ObjectType;
|
||||
|
||||
class OrderedCollectionObject extends ObjectType
|
||||
{
|
||||
protected string $type = 'OrderedCollection';
|
||||
|
||||
protected int $totalItems;
|
||||
|
||||
protected ?string $first = null;
|
||||
|
||||
protected ?string $current = null;
|
||||
|
||||
protected ?string $last = null;
|
||||
|
||||
/**
|
||||
* @param ObjectType[]|null $orderedItems
|
||||
*/
|
||||
public function __construct(
|
||||
protected ?array $orderedItems = null,
|
||||
?Pager $pager = null
|
||||
) {
|
||||
$this->id = current_url();
|
||||
|
||||
if ($pager !== null) {
|
||||
$totalItems = $pager->getTotal();
|
||||
$this->totalItems = $totalItems;
|
||||
|
||||
if ($totalItems !== 0) {
|
||||
$this->first = $pager->getPageURI($pager->getFirstPage());
|
||||
$this->current = $pager->getPageURI();
|
||||
$this->last = $pager->getPageURI($pager->getLastPage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue