44
55namespace Checkend ;
66
7+ use Exception ;
8+ use RuntimeException ;
9+
710/**
811 * HTTP client for sending notices to Checkend.
912 */
@@ -36,7 +39,7 @@ public function send(Notice $notice): ?array
3639 $ response = $ this ->post ($ payload );
3740 $ this ->configuration ->log ('debug ' , 'Notice sent successfully: ' . json_encode ($ response ));
3841 return $ response ;
39- } catch (\ Exception $ e ) {
42+ } catch (Exception $ e ) {
4043 $ this ->configuration ->log ('error ' , 'Failed to send notice: ' . $ e ->getMessage ());
4144 return null ;
4245 }
@@ -50,7 +53,7 @@ private function post(array $payload): array
5053 {
5154 $ data = json_encode ($ payload );
5255 if ($ data === false ) {
53- throw new \ RuntimeException ('Failed to encode payload ' );
56+ throw new RuntimeException ('Failed to encode payload ' );
5457 }
5558
5659 $ context = $ this ->createStreamContext ($ data );
@@ -64,16 +67,16 @@ private function post(array $payload): array
6467
6568 if ($ statusCode !== 201 ) {
6669 $ this ->handleHttpError ($ statusCode , $ response ?: '' );
67- throw new \ RuntimeException ('HTTP error: ' . $ statusCode );
70+ throw new RuntimeException ('HTTP error: ' . $ statusCode );
6871 }
6972
7073 if ($ response === false ) {
71- throw new \ RuntimeException ('Failed to read response ' );
74+ throw new RuntimeException ('Failed to read response ' );
7275 }
7376
7477 $ decoded = json_decode ($ response , true );
7578 if (!is_array ($ decoded )) {
76- throw new \ RuntimeException ('Failed to decode response ' );
79+ throw new RuntimeException ('Failed to decode response ' );
7780 }
7881
7982 return $ decoded ;
0 commit comments