@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** @return array<int|string, mixed> */ |
| 35 | 35 | private function fakeResponse(string $schemaFile): array |
| 36 | 36 | { |
| 37 | - if (! class_exists(Faker::class)) { |
|
| 37 | + if (!class_exists(Faker::class)) { |
|
| 38 | 38 | throw new LogicException('"koriym/json-schema-faker" not installed. Please run "composer require koriym/json-schema-faker --dev". See more at https://github.com/bearsunday/BEAR.Resource/wiki/json_schema_faker_required'); // @codeCoverageIgnore |
| 39 | 39 | } |
| 40 | 40 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @return array<int|string, mixed> |
| 51 | 51 | */ |
| 52 | - private function deepArray(array|stdClass $values): array |
|
| 52 | + private function deepArray(array | stdClass $values): array |
|
| 53 | 53 | { |
| 54 | 54 | $result = []; |
| 55 | 55 | /** @psalm-suppress MixedAssignment */ |
@@ -33,6 +33,6 @@ |
||
| 33 | 33 | return $ro; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - throw new MethodNotAllowedException($request->resourceObject::class . "::{({$request->method}}()", 405); |
|
| 36 | + throw new MethodNotAllowedException($request->resourceObject::class."::{({$request->method}}()", 405); |
|
| 37 | 37 | } |
| 38 | 38 | } |
@@ -19,13 +19,13 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | /** @param array<string, mixed>|null $data */ |
| 21 | 21 | public function __construct( |
| 22 | - public readonly ?array $data = null, |
|
| 22 | + public readonly ? array $data = null, |
|
| 23 | 23 | ) { |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function start(): self |
| 27 | 27 | { |
| 28 | - if (! function_exists('xhprof_enable')) { |
|
| 28 | + if (!function_exists('xhprof_enable')) { |
|
| 29 | 29 | return new self(); // @codeCoverageIgnore |
| 30 | 30 | } |
| 31 | 31 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function stop(string $uri): self |
| 39 | 39 | { |
| 40 | - if (! function_exists('xhprof_disable')) { |
|
| 40 | + if (!function_exists('xhprof_disable')) { |
|
| 41 | 41 | return new self(); // @codeCoverageIgnore |
| 42 | 42 | } |
| 43 | 43 | |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $this->uri = $request->toUri(); |
| 40 | 40 | $this->call = [ |
| 41 | 41 | $request->resourceObject::class, |
| 42 | - 'on' . ucfirst(strtolower($request->method)) |
|
| 42 | + 'on'.ucfirst(strtolower($request->method)) |
|
| 43 | 43 | ]; |
| 44 | 44 | |
| 45 | 45 | // Start profiling (but don't capture data yet - that's for close) |
@@ -12,18 +12,18 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | $logDirectory = $argv[1] ?? null; |
| 14 | 14 | |
| 15 | -if (! $logDirectory) { |
|
| 15 | +if (!$logDirectory) { |
|
| 16 | 16 | fwrite(STDERR, "Usage: php server.php <log-directory>\n"); |
| 17 | 17 | exit(1); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if (! is_dir($logDirectory)) { |
|
| 20 | +if (!is_dir($logDirectory)) { |
|
| 21 | 21 | fwrite(STDERR, "Directory not found: $logDirectory\n"); |
| 22 | 22 | exit(1); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | // Find the latest semantic log file |
| 26 | -$pattern = rtrim($logDirectory, '/') . '/semantic-dev-*.json'; |
|
| 26 | +$pattern = rtrim($logDirectory, '/').'/semantic-dev-*.json'; |
|
| 27 | 27 | $files = glob($pattern); |
| 28 | 28 | |
| 29 | 29 | if (empty($files)) { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | while ($line = fgets(STDIN)) { |
| 45 | 45 | $request = json_decode(trim($line), true); |
| 46 | 46 | |
| 47 | - if (! $request) { |
|
| 47 | + if (!$request) { |
|
| 48 | 48 | continue; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | ] |
| 108 | 108 | }; |
| 109 | 109 | |
| 110 | - fwrite(STDOUT, json_encode($response) . "\n"); |
|
| 110 | + fwrite(STDOUT, json_encode($response)."\n"); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | function getLog(string $file): array |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | 'content' => [ |
| 130 | 130 | [ |
| 131 | 131 | 'type' => 'text', |
| 132 | - 'text' => $analysisPrompt . "\n\n```json\n" . json_encode($logData, JSON_PRETTY_PRINT) . "\n```", |
|
| 132 | + 'text' => $analysisPrompt."\n\n```json\n".json_encode($logData, JSON_PRETTY_PRINT)."\n```", |
|
| 133 | 133 | ], |
| 134 | 134 | ], |
| 135 | 135 | 'isError' => false, |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | 'content' => [ |
| 145 | 145 | [ |
| 146 | 146 | 'type' => 'text', |
| 147 | - 'text' => 'Unknown tool: ' . $toolName, |
|
| 147 | + 'text' => 'Unknown tool: '.$toolName, |
|
| 148 | 148 | ], |
| 149 | 149 | ], |
| 150 | 150 | 'isError' => true, |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $script = $args['script'] ?? ''; |
| 157 | 157 | $xdebugMode = $args['xdebug_mode'] ?? 'trace'; |
| 158 | 158 | |
| 159 | - if (! $script) { |
|
| 159 | + if (!$script) { |
|
| 160 | 160 | return [ |
| 161 | 161 | 'content' => [ |
| 162 | 162 | [ |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | ]; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if (! file_exists($script)) { |
|
| 171 | + if (!file_exists($script)) { |
|
| 172 | 172 | return [ |
| 173 | 173 | 'content' => [ |
| 174 | 174 | [ |
@@ -185,14 +185,14 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | // Execute the PHP script with profiling using php-dev.ini |
| 187 | 187 | $env = "XDEBUG_MODE=$xdebugMode XDEBUG_CONFIG='compression_level=0'"; |
| 188 | - $phpDevIni = __DIR__ . '/php-dev.ini'; |
|
| 189 | - $command = "$env php -c " . escapeshellarg($phpDevIni) . ' ' . escapeshellarg($script) . ' 2>&1'; |
|
| 188 | + $phpDevIni = __DIR__.'/php-dev.ini'; |
|
| 189 | + $command = "$env php -c ".escapeshellarg($phpDevIni).' '.escapeshellarg($script).' 2>&1'; |
|
| 190 | 190 | |
| 191 | 191 | $output = shell_exec($command); |
| 192 | 192 | |
| 193 | 193 | // Find semantic log files created during script execution |
| 194 | 194 | $logDirectory = $GLOBALS['logDirectory']; |
| 195 | - $pattern = rtrim($logDirectory, '/') . '/semantic-dev-*.json'; |
|
| 195 | + $pattern = rtrim($logDirectory, '/').'/semantic-dev-*.json'; |
|
| 196 | 196 | |
| 197 | 197 | $files = glob($pattern); |
| 198 | 198 | $newLogFiles = array_filter($files, static fn ($file) => filemtime($file) >= $beforeExecution); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | 'content' => [ |
| 222 | 222 | [ |
| 223 | 223 | 'type' => 'text', |
| 224 | - 'text' => "Script executed successfully.\nLog file: $executionLog\n\n" . $analysisPrompt . "\n\n```json\n" . json_encode($logData, JSON_PRETTY_PRINT) . "\n```", |
|
| 224 | + 'text' => "Script executed successfully.\nLog file: $executionLog\n\n".$analysisPrompt."\n\n```json\n".json_encode($logData, JSON_PRETTY_PRINT)."\n```", |
|
| 225 | 225 | ], |
| 226 | 226 | ], |
| 227 | 227 | 'isError' => false, |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | |
| 69 | 69 | // Save analysis prompt alongside JSON for AI-native processing |
| 70 | 70 | $promptFilename = str_replace('.json', '-prompt.md', $filename); |
| 71 | - $analysisPrompt = $this->getAnalysisPrompt() . "\n\n```json\n" . $jsonContent . "\n```"; |
|
| 71 | + $analysisPrompt = $this->getAnalysisPrompt()."\n\n```json\n".$jsonContent."\n```"; |
|
| 72 | 72 | file_put_contents($promptFilename, $analysisPrompt, LOCK_EX); |
| 73 | 73 | } |
| 74 | 74 | |