<?php declare(strict_types=1);

namespace App\Service;

class PaginationMaker
{
    /**
     * Paginate an array of items based on the page and items per page.
     *
     * @param array $items The array of items to paginate.
     * @param int $page The current page number.
     * @param int $perPage The number of items to display per page.
     * @return array The paginated subset of items for the current page.
     */
    public function paginate(array $items, int $page, int $perPage): array
    {
        $offset = ($page - 1) * $perPage;

        return array_slice($items, $offset, $perPage);
    }
}
