@@ -24,31 +24,41 @@ public function __construct(bool $verbose = false, ?SymfonyOutput $output = null
24
24
$ this ->output = $ output ?? new SymfonyOutput ();
25
25
}
26
26
27
- public function printStartMessage (string $ host , int $ port , array $ environment ): void
27
+ public function printStartMessage (string $ host , int $ port , array $ environment = [] ): void
28
28
{
29
29
$ url = sprintf ('%s://%s:%d ' , $ port === 443 ? 'https ' : 'http ' , $ host , $ port );
30
30
31
- $ statusOptions = [
32
- 'enabled ' => 'green-500 ' ,
33
- 'disabled ' => 'red-500 ' ,
34
- 'overridden ' => 'yellow-500 ' ,
35
- ];
36
-
37
- $ dashboardStatusValue = config ('hyde.server.dashboard.enabled ' );
38
- $ dashboardOverridden = Arr::has ($ environment , 'HYDE_SERVER_DASHBOARD ' );
39
- $ dashboardStatus = $ dashboardOverridden ? 'overridden ' : ($ dashboardStatusValue ? 'enabled ' : 'disabled ' );
40
- $ dashboardStatusMessage = sprintf ('<span class="text-white">Dashboard:</span> <span class="text-%s">%s</span> ' , $ statusOptions [$ dashboardStatus ], $ dashboardStatusValue ? 'enabled ' : 'disabled ' );
41
-
42
31
$ lines = [
43
32
'' ,
44
33
sprintf ('<span class="text-blue-500">%s</span> <span class="text-gray">%s</span> ' , 'HydePHP Realtime Compiler ' , 'v ' .Hyde::getInstance ()->version ()),
45
34
'' ,
46
35
sprintf ('<span class="text-white">Listening on</span> <a href="%s" class="text-yellow-500">%s</a> ' , $ url , $ url ),
47
36
'' ,
48
- $ dashboardStatusMessage ,
49
- '' ,
50
37
];
51
38
39
+ if ($ environment !== []) {
40
+ $ statusOptions = [
41
+ 'enabled ' => 'green-500 ' ,
42
+ 'disabled ' => 'red-500 ' ,
43
+ ];
44
+
45
+ if (Arr::has ($ environment , 'HYDE_SERVER_DASHBOARD ' )) {
46
+ $ dashboardStatus = Arr::get ($ environment , 'HYDE_SERVER_DASHBOARD ' );
47
+ $ dashboardStatusValue = $ dashboardStatus === 'enabled ' ;
48
+ $ dashboardStatusMessage = sprintf ('<span class="text-white">Dashboard:</span> <span class="text-%s">%s</span> ' , $ statusOptions [$ dashboardStatus ], $ dashboardStatusValue ? 'enabled ' : 'disabled ' );
49
+ }
50
+
51
+ $ optionLines = Arr::whereNotNull ([
52
+ $ dashboardStatusMessage ?? null ,
53
+ ]);
54
+
55
+ if ($ optionLines !== []) {
56
+ $ optionLines [] = '' ;
57
+ }
58
+
59
+ $ lines = array_merge ($ lines , $ optionLines );
60
+ }
61
+
52
62
$ lineLength = max (array_map ('strlen ' , array_map ('strip_tags ' , $ lines )));
53
63
54
64
$ lines = array_map (function (string $ line ) use ($ lineLength ): string {
0 commit comments