params = $params; $this->httpClient = $httpClient; $this->logService = $logService; } /** * @param array $medias * @param string $token * @param bool $async * * @return void */ public function saveNotification(array $notif, string $token, bool $async = false): void { try { if ($async) { $this->logService->setLog('Notification : Sending notification : ' . $this->params->get('domain_admin') . '/notification.json with param : ' . json_encode($notif)); } $this->httpClient->data('POST', $this->params->get('domain_admin') . '/notification.json', [ 'headers' => [ 'x-auth-token' => $token, ], 'json' => $notif, ]); } catch (Exception $e) { if (!$async) { throw new InternalServerErrorMaestroException($e->getMessage()); } else { $this->logService->setLog('Notification : Cannot managed notification : ' . $e->getMessage()); } } } }