diff --git a/src/ConnectionRepository.php b/src/ConnectionRepository.php index 5fe631b..44b0df9 100644 --- a/src/ConnectionRepository.php +++ b/src/ConnectionRepository.php @@ -4,16 +4,18 @@ use Aws\ApiGatewayManagementApi\ApiGatewayManagementApiClient; use Aws\ApiGatewayManagementApi\Exception\ApiGatewayManagementApiException; -use GuzzleHttp\Exception\ClientException; class ConnectionRepository { protected ApiGatewayManagementApiClient $apiGatewayManagementApiClient; + protected SubscriptionRepository $subscriptionRepository; public function __construct( - protected SubscriptionRepository $subscriptionRepository, + SubscriptionRepository $subscriptionRepository, array $config ) { + $this->subscriptionRepository = $subscriptionRepository; + $this->apiGatewayManagementApiClient = new ApiGatewayManagementApiClient(array_merge($config['connection'], [ 'version' => '2018-11-29', 'endpoint' => "https://{$config['api']['id']}.execute-api.{$config['connection']['region']}.amazonaws.com/{$config['api']['stage']}/", diff --git a/src/Handler.php b/src/Handler.php index 1517fb7..d0708db 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -13,9 +13,12 @@ class Handler extends WebsocketHandler { + protected SubscriptionRepository $subscriptionRepository; + protected ConnectionRepository $connectionRepository; + public function __construct( - protected SubscriptionRepository $subscriptionRepository, - protected ConnectionRepository $connectionRepository + SubscriptionRepository $subscriptionRepository, + ConnectionRepository $connectionRepository ) { $this->subscriptionRepository = $subscriptionRepository; $this->connectionRepository = $connectionRepository;