Skip to content

Commit 9372358

Browse files
kargnasgithub-actions[bot]
authored andcommitted
Fix styling
1 parent 0b38d9a commit 9372358

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

src/Services/SseAdapterFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ public function createAdapter(): SseAdapterInterface
5959
*/
6060
private function initializeAdapter(): void
6161
{
62-
$adapterConfig = Config::get('mcp-server.adapters.' . $this->adapterType, []);
62+
$adapterConfig = Config::get('mcp-server.adapters.'.$this->adapterType, []);
6363

6464
switch ($this->adapterType) {
6565
case 'redis':
6666
$this->adapter = new RedisAdapter;
6767
break;
6868
default:
69-
throw new Exception('Unsupported SSE adapter type: ' . $this->adapterType);
69+
throw new Exception('Unsupported SSE adapter type: '.$this->adapterType);
7070
}
7171

7272
$this->adapter->initialize($adapterConfig);

src/Transports/SseAdapters/RedisAdapter.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public function initialize(array $config): void
5252
$this->messageTtl = (int) $config['ttl'];
5353
}
5454
} catch (Exception $e) {
55-
Log::error('Failed to initialize Redis SSE Adapter: ' . $e->getMessage());
56-
throw new Exception('Failed to initialize Redis SSE Adapter: ' . $e->getMessage());
55+
Log::error('Failed to initialize Redis SSE Adapter: '.$e->getMessage());
56+
throw new Exception('Failed to initialize Redis SSE Adapter: '.$e->getMessage());
5757
}
5858
}
5959

@@ -75,8 +75,8 @@ public function pushMessage(string $clientId, string $message): void
7575
$this->redis->expire($key, $this->messageTtl);
7676

7777
} catch (Exception $e) {
78-
Log::error('Failed to add message to Redis queue: ' . $e->getMessage());
79-
throw new Exception('Failed to add message to Redis queue: ' . $e->getMessage());
78+
Log::error('Failed to add message to Redis queue: '.$e->getMessage());
79+
throw new Exception('Failed to add message to Redis queue: '.$e->getMessage());
8080
}
8181
}
8282

@@ -108,8 +108,8 @@ public function removeAllMessages(string $clientId): void
108108
$this->redis->del($key);
109109

110110
} catch (Exception $e) {
111-
Log::error('Failed to remove messages from Redis queue: ' . $e->getMessage());
112-
throw new Exception('Failed to remove messages from Redis queue: ' . $e->getMessage());
111+
Log::error('Failed to remove messages from Redis queue: '.$e->getMessage());
112+
throw new Exception('Failed to remove messages from Redis queue: '.$e->getMessage());
113113
}
114114
}
115115

@@ -133,7 +133,7 @@ public function receiveMessages(string $clientId): array
133133

134134
return $messages;
135135
} catch (Exception $e) {
136-
throw new Exception('Failed to receive messages from Redis queue: ' . $e->getMessage());
136+
throw new Exception('Failed to receive messages from Redis queue: '.$e->getMessage());
137137
}
138138
}
139139

@@ -158,8 +158,8 @@ public function popMessage(string $clientId): ?string
158158

159159
return $message;
160160
} catch (Exception $e) {
161-
Log::error('Failed to pop message from Redis queue: ' . $e->getMessage());
162-
throw new Exception('Failed to pop message from Redis queue: ' . $e->getMessage());
161+
Log::error('Failed to pop message from Redis queue: '.$e->getMessage());
162+
throw new Exception('Failed to pop message from Redis queue: '.$e->getMessage());
163163
}
164164
}
165165

@@ -178,7 +178,7 @@ public function hasMessages(string $clientId): bool
178178

179179
return $count > 0;
180180
} catch (Exception $e) {
181-
Log::error('Failed to check for messages in Redis queue: ' . $e->getMessage());
181+
Log::error('Failed to check for messages in Redis queue: '.$e->getMessage());
182182

183183
return false;
184184
}
@@ -199,7 +199,7 @@ public function getMessageCount(string $clientId): int
199199

200200
return (int) $count;
201201
} catch (Exception $e) {
202-
Log::error('Failed to get message count from Redis queue: ' . $e->getMessage());
202+
Log::error('Failed to get message count from Redis queue: '.$e->getMessage());
203203

204204
return 0;
205205
}

src/Transports/SseTransport.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function initialize(): void
9797
private function sendEvent(string $event, string $data): void
9898
{
9999
// 헤더 설정이 이미 전송되었는지 확인
100-
if (!headers_sent()) {
100+
if (! headers_sent()) {
101101
// 버퍼링 비활성화
102102
ini_set('output_buffering', 'off');
103103
ini_set('zlib.output_compression', false);
@@ -114,8 +114,8 @@ private function sendEvent(string $event, string $data): void
114114
ob_end_flush();
115115
}
116116

117-
echo sprintf("event: %s", $event) . PHP_EOL;
118-
echo sprintf("data: %s", $data) . PHP_EOL;
117+
echo sprintf('event: %s', $event).PHP_EOL;
118+
echo sprintf('data: %s', $data).PHP_EOL;
119119
echo PHP_EOL;
120120

121121
flush();
@@ -146,7 +146,7 @@ public function send(string|array $message): void
146146
*/
147147
public function close(): void
148148
{
149-
if (!$this->connected) {
149+
if (! $this->connected) {
150150
return;
151151
}
152152

@@ -156,22 +156,22 @@ public function close(): void
156156
try {
157157
call_user_func($handler);
158158
} catch (Exception $e) {
159-
Log::error('Error in SSE close handler: ' . $e->getMessage());
159+
Log::error('Error in SSE close handler: '.$e->getMessage());
160160
}
161161
}
162162

163163
if ($this->adapter !== null && $this->clientId !== null) {
164164
try {
165165
$this->adapter->removeAllMessages($this->clientId);
166166
} catch (Exception $e) {
167-
Log::error('Error cleaning up SSE adapter resources on close: ' . $e->getMessage());
167+
Log::error('Error cleaning up SSE adapter resources on close: '.$e->getMessage());
168168
}
169169
}
170170

171171
try {
172172
$this->sendEvent(event: 'close', data: '{"reason":"server_closed"}');
173173
} catch (Exception $e) {
174-
Log::info('Could not send final SSE close event: ' . $e->getMessage());
174+
Log::info('Could not send final SSE close event: '.$e->getMessage());
175175
}
176176
}
177177

@@ -230,7 +230,7 @@ public function receive(): array
230230

231231
return $messages ?: [];
232232
} catch (Exception $e) {
233-
$this->triggerError('SSE Failed to receive messages via adapter: ' . $e->getMessage());
233+
$this->triggerError('SSE Failed to receive messages via adapter: '.$e->getMessage());
234234
}
235235
} elseif ($this->adapter === null) {
236236
Log::info('SSE Transport::receive called but no adapter is configured.');
@@ -247,13 +247,13 @@ public function receive(): array
247247
*/
248248
protected function triggerError(string $message): void
249249
{
250-
Log::error('SSE Transport error: ' . $message);
250+
Log::error('SSE Transport error: '.$message);
251251

252252
foreach ($this->errorHandlers as $handler) {
253253
try {
254254
call_user_func($handler, $message);
255255
} catch (Exception $e) {
256-
Log::error('Error in SSE error handler itself: ' . $e->getMessage());
256+
Log::error('Error in SSE error handler itself: '.$e->getMessage());
257257
}
258258
}
259259
}
@@ -281,7 +281,7 @@ public function processMessage(string $clientId, array $message): void
281281
try {
282282
$handler($clientId, $message);
283283
} catch (Exception $e) {
284-
Log::error('Error processing SSE message via handler: ' . $e->getMessage(), [
284+
Log::error('Error processing SSE message via handler: '.$e->getMessage(), [
285285
'clientId' => $clientId,
286286
// Avoid logging potentially sensitive message content in production
287287
// 'message_summary' => is_array($message) ? json_encode(array_keys($message)) : substr($message, 0, 100)
@@ -307,7 +307,7 @@ public function pushMessage(string $clientId, array $message): void
307307

308308
$messageString = json_encode($message);
309309
if ($messageString === false) {
310-
throw new Exception('Failed to JSON encode message for pushing: ' . json_last_error_msg());
310+
throw new Exception('Failed to JSON encode message for pushing: '.json_last_error_msg());
311311
}
312312

313313
$this->adapter->pushMessage(clientId: $clientId, message: $messageString);

0 commit comments

Comments
 (0)