8
8
use Illuminate \Support \Collection ;
9
9
use Illuminate \Support \Facades \File ;
10
10
use Illuminate \Support \Facades \Process ;
11
+
11
12
use function Laravel \Prompts \error ;
12
- use function Laravel \Prompts \intro ;
13
13
use function Laravel \Prompts \info ;
14
+ use function Laravel \Prompts \intro ;
14
15
use function Laravel \Prompts \note ;
15
16
use function Laravel \Prompts \outro ;
16
17
use function Laravel \Prompts \select ;
17
18
18
19
class DebugCommand extends Command implements PromptsForMissingInput
19
20
{
20
21
protected $ signature = 'native:debug {output} ' ;
22
+
21
23
protected $ description = 'Generate debug information required for opening an issue. ' ;
22
24
23
25
private Collection $ debugInfo ;
@@ -56,7 +58,7 @@ private function processEnvironment(): static
56
58
'Laravel ' => [
57
59
'Version ' => app ()->version (),
58
60
'ConfigCached ' => file_exists ($ this ->laravel ->getCachedConfigPath ()),
59
- 'DebugEnabled ' => $ this ->laravel ->hasDebugModeEnabled ()
61
+ 'DebugEnabled ' => $ this ->laravel ->hasDebugModeEnabled (),
60
62
],
61
63
'Node ' => [
62
64
'Version ' => trim (Process::run ('node -v ' )->output ()),
@@ -132,17 +134,17 @@ private function processErrorLog(): void
132
134
133
135
// Check if string starts with date format Y-m-d H:i:s in square brackets
134
136
if (preg_match ('/^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\]/ ' , $ line )) {
135
- if (!empty ($ currentLine )) {
137
+ if (! empty ($ currentLine )) {
136
138
$ errors [] = $ currentLine ;
137
139
$ currentLine = '' ;
138
140
$ errorCount ++;
139
141
}
140
142
}
141
143
142
- $ currentLine .= $ line . PHP_EOL ;
144
+ $ currentLine .= $ line. PHP_EOL ;
143
145
}
144
146
145
- if (!empty ($ currentLine )) {
147
+ if (! empty ($ currentLine )) {
146
148
$ errors [] = $ currentLine ;
147
149
}
148
150
@@ -156,14 +158,14 @@ protected function promptForMissingArgumentsUsing(): array
156
158
'Where would you like to output the debug information? ' ,
157
159
['File ' , 'Console ' ],
158
160
'File '
159
- )
161
+ ),
160
162
];
161
163
}
162
164
163
165
private function outputToFile (): void
164
166
{
165
167
File::put (base_path ('nativephp_debug.json ' ), json_encode ($ this ->debugInfo ->toArray (), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ));
166
- note ('Debug information saved to ' . base_path ('nativephp_debug.json ' ));
168
+ note ('Debug information saved to ' . base_path ('nativephp_debug.json ' ));
167
169
}
168
170
169
171
private function outputToConsole (): void
0 commit comments