refactor: split buspro ApiClient into domain clients
This commit is contained in:
1 parent
0a55544ca8
commit
b755a6f43e
52 files changed
+805
-695
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Controller\Api;
|
||||
|
||||
use App\BusProNet\ApiClient;
|
||||
use App\BusProNet\Client\TravelClient;
|
||||
use App\BusProNet\Exception\ApiClientException;
|
||||
use Psr\Cache\InvalidArgumentException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@@ -17,7 +17,7 @@ use Symfony\Contracts\Cache\ItemInterface;
|
||||
class ProductController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ApiClient $apiClient,
|
||||
private readonly TravelClient $travelClient,
|
||||
private readonly CacheInterface $cache,
|
||||
) {
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class ProductController extends AbstractController
|
||||
$products = $this->cache->get('api_products', function (ItemInterface $item) {
|
||||
$item->expiresAfter(3600); // 1 hour cache
|
||||
|
||||
return $this->apiClient->getProducts();
|
||||
return $this->travelClient->getProducts();
|
||||
});
|
||||
|
||||
return $this->json($products);
|
||||
|
||||
Reference in new issue
Block a user