This change updates the namespace across multiple files to reflect the new naming convention.
48 lines
931 B
PHP
48 lines
931 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Uwil\ArcadiaApiPhpClient\Lib\ApiDto\Dto;
|
|
|
|
use Uwil\ArcadiaApiPhpClient\Lib\ApiDto\Dto;
|
|
|
|
/**
|
|
* A page of items with pagination metadata.
|
|
*
|
|
* @template T
|
|
*/
|
|
final readonly class PageOf implements Dto
|
|
{
|
|
/** @var array<int,T> */
|
|
private array $items;
|
|
|
|
/**
|
|
* @param array<int, T> $items
|
|
*/
|
|
public function __construct(
|
|
private PaginationDto $pagination,
|
|
array $items
|
|
) {
|
|
// * Shallow copy
|
|
$this->items = array_values($items);
|
|
}
|
|
|
|
/** @return array<int, T> $items */
|
|
public function items(): array
|
|
{
|
|
return [...$this->items];
|
|
}
|
|
|
|
public function pagination(): PaginationDto
|
|
{
|
|
return $this->pagination;
|
|
}
|
|
|
|
public function jsonSerialize(): mixed
|
|
{
|
|
return [
|
|
'pagination' => $this->pagination,
|
|
'items' => $this->items,
|
|
];
|
|
}
|
|
}
|