igmf/kernel/modules/module_shop_client/services/ModuleShopClientService.php

22 lines
831 B
PHP
Raw Normal View History

2024-12-23 15:47:03 +03:00
<?php
namespace kernel\modules\module_shop_client\services;
use kernel\helpers\RESTClient;
class ModuleShopClientService
{
2024-12-23 16:41:47 +03:00
public function getModulesInfo(string $url, int $perPage, int $pageNumber): \Psr\Http\Message\ResponseInterface
2024-12-23 15:47:03 +03:00
{
2024-12-23 16:41:47 +03:00
$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);
2024-12-23 15:47:03 +03:00
}
}