Skip to content

Commit 74a3bff

Browse files
committed
fix: wip
2 parents 029ada0 + 0242a39 commit 74a3bff

File tree

2 files changed

+66
-67
lines changed

2 files changed

+66
-67
lines changed

src/Mcp/Tools/DebugApplicationTool.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ protected function performHealthCheck(): array
129129
'status' => version_compare($phpVersion, '8.1.0', '>=') ? 'success' : 'warning',
130130
'value' => $phpVersion,
131131
'message' => version_compare($phpVersion, '8.1.0', '>=') ? 'PHP version compatible' : 'PHP version may be outdated',
132-
];
132+
];
133133

134134
// Environment check
135135
$environment = app()->environment();
@@ -152,7 +152,7 @@ protected function performHealthCheck(): array
152152
Cache::put('debug_test', 'test', 10);
153153
$cacheWorks = Cache::get('debug_test') === 'test';
154154
Cache::forget('debug_test');
155-
155+
156156
$checks['cache'] = [
157157
'status' => $cacheWorks ? 'success' : 'error',
158158
'value' => config('cache.default'),
@@ -214,7 +214,7 @@ protected function analyzeConfiguration(): array
214214

215215
if (File::exists($restifyConfigPath)) {
216216
$restifyConfig = include $restifyConfigPath;
217-
217+
218218
$analysis['restify_config']['middleware'] = [
219219
'status' => isset($restifyConfig['middleware']) ? 'success' : 'warning',
220220
'value' => isset($restifyConfig['middleware']) ? count($restifyConfig['middleware']) : 0,
@@ -366,7 +366,7 @@ protected function findRepositories(): array
366366
foreach ($finder as $file) {
367367
$filePath = $file->getRealPath();
368368
$content = File::get($filePath);
369-
369+
370370
if (str_contains($content, 'extends Repository') || str_contains($content, 'use Repository')) {
371371
$repositories[$filePath] = [
372372
'name' => $file->getFilenameWithoutExtension(),
@@ -396,7 +396,7 @@ protected function analyzeRepository(string $filePath): array
396396
// Check for fields method
397397
if (preg_match('/public\s+function\s+fields\s*\([^)]*\)\s*:\s*array/', $content)) {
398398
$analysis['has_fields_method'] = true;
399-
399+
400400
// Count fields
401401
if (preg_match('/public\s+function\s+fields\s*\([^)]*\)\s*:\s*array\s*{(.*?)}/s', $content, $matches)) {
402402
$fieldsContent = $matches[1];
@@ -423,7 +423,7 @@ protected function analyzeRepository(string $filePath): array
423423
// Check for relationships
424424
if (preg_match('/public\s+static\s+function\s+include\s*\(\)\s*:\s*array/', $content)) {
425425
$analysis['has_relationships'] = true;
426-
426+
427427
// Count relationships
428428
if (preg_match('/public\s+static\s+function\s+include\s*\(\)\s*:\s*array\s*{(.*?)}/s', $content, $matches)) {
429429
$includeContent = $matches[1];
@@ -435,7 +435,7 @@ protected function analyzeRepository(string $filePath): array
435435
}
436436

437437
// Check for authorization
438-
if (str_contains($content, 'public function allowedToShow') ||
438+
if (str_contains($content, 'public function allowedToShow') ||
439439
str_contains($content, 'public function allowedToStore') ||
440440
str_contains($content, 'public function allowedToUpdate')) {
441441
$analysis['has_authorization'] = true;
@@ -557,7 +557,7 @@ protected function attemptAutoFix(array $issue): ?array
557557
'--provider' => 'Binaryk\\LaravelRestify\\LaravelRestifyServiceProvider',
558558
'--tag' => 'config'
559559
]);
560-
560+
561561
return [
562562
'issue' => $issue['message'],
563563
'fix' => 'Published Restify config file',
@@ -582,7 +582,7 @@ protected function generateSuggestions(array $report): array
582582
$suggestions = [];
583583

584584
// Performance suggestions
585-
if (isset($report['performance_check']['cache_driver']['status']) &&
585+
if (isset($report['performance_check']['cache_driver']['status']) &&
586586
$report['performance_check']['cache_driver']['status'] === 'warning') {
587587
$suggestions[] = [
588588
'category' => 'performance',
@@ -621,7 +621,7 @@ protected function exportReport(array $report): void
621621
{
622622
$reportPath = storage_path('logs/debug-report-' . date('Y-m-d-H-i-s') . '.md');
623623
$reportContent = $this->generateMarkdownReport($report);
624-
624+
625625
File::put($reportPath, $reportContent);
626626
}
627627

@@ -669,11 +669,11 @@ protected function generateMarkdownReport(array $report): string
669669
protected function generateDebugReport(array $report, bool $detailed): ToolResult
670670
{
671671
$response = "# Laravel Restify Debug Report\n\n";
672-
672+
673673
// Overall status
674674
$criticalIssues = $report['summary']['critical_issues'] ?? 0;
675675
$warnings = $report['summary']['warnings'] ?? 0;
676-
676+
677677
if ($criticalIssues > 0) {
678678
$response .= "🔴 **Status: CRITICAL** - $criticalIssues critical issues found\n\n";
679679
} elseif ($warnings > 0) {
@@ -723,25 +723,25 @@ protected function generateDebugReport(array $report, bool $detailed): ToolResul
723723
// Restify Analysis
724724
if (!empty($report['restify_analysis'])) {
725725
$response .= "## Restify Analysis\n\n";
726-
726+
727727
if (isset($report['restify_analysis']['repositories'])) {
728728
$repos = $report['restify_analysis']['repositories'];
729729
$emoji = $this->getStatusEmoji($repos['status']);
730730
$response .= "$emoji **Repositories:** {$repos['message']} ({$repos['count']} found)\n";
731-
731+
732732
if (!empty($repos['list']) && $detailed) {
733733
foreach ($repos['list'] as $repo) {
734734
$response .= " - $repo\n";
735735
}
736736
}
737737
}
738-
738+
739739
if (isset($report['restify_analysis']['routes'])) {
740740
$routes = $report['restify_analysis']['routes'];
741741
$emoji = $this->getStatusEmoji($routes['status']);
742742
$response .= "$emoji **Routes:** {$routes['message']} ({$routes['count']} found)\n";
743743
}
744-
744+
745745
$response .= "\n";
746746
}
747747

@@ -785,7 +785,7 @@ protected function generateDebugReport(array $report, bool $detailed): ToolResul
785785
} else {
786786
$response .= "1. **System looks healthy!** Consider the recommendations above for optimization\n";
787787
}
788-
788+
789789
$response .= "2. **Run with fix_issues=true** to automatically fix common problems\n";
790790
$response .= "3. **Export detailed report** with export_report=true for documentation\n";
791791

@@ -806,10 +806,10 @@ protected function getStatusEmoji(string $status): string
806806
protected function formatBytes(int $size, int $precision = 2): string
807807
{
808808
if ($size === 0) return '0B';
809-
809+
810810
$base = log($size, 1024);
811811
$suffixes = ['B', 'KB', 'MB', 'GB', 'TB'];
812-
812+
813813
return round(pow(1024, $base - floor($base)), $precision) . ' ' . $suffixes[floor($base)];
814814
}
815-
}
815+
}

0 commit comments

Comments
 (0)