igmf/kernel/modules/module_shop_client/services/ModuleShopClientService.php
2024-12-23 16:41:47 +03:00

22 lines
831 B
PHP

<?php
namespace kernel\modules\module_shop_client\services;
use kernel\helpers\RESTClient;
class ModuleShopClientService
{
public function getModulesInfo(string $url, int $perPage, int $pageNumber): \Psr\Http\Message\ResponseInterface
{
$modules_info = RESTClient::request($url);
$modules_info = json_decode($modules_info->getBody()->getContents(), true);
return array_slice($modules_info, $perPage * ($pageNumber - 1), $perPage);
}
public function getModulesInfoWithFilters(string $url, int $perPage, int $pageNumber): \Psr\Http\Message\ResponseInterface
{
$modules_info = RESTClient::request($url);
$modules_info = json_decode($modules_info->getBody()->getContents(), true);
return array_slice($modules_info, $perPage * ($pageNumber - 1), $perPage);
}
}