@@ -20,44 +20,55 @@ class DumpServerCommand extends Command
20
20
*
21
21
* @var string
22
22
*/
23
- protected $ signature = 'dump-server {--format=cli : The output format (cli,html)} ' ;
23
+ protected $ signature = 'dump-server {--format=cli : The output format (cli,html). } ' ;
24
24
25
25
/**
26
26
* The console command description.
27
27
*
28
28
* @var string
29
29
*/
30
- protected $ description = 'Start the dump server to collect dump information ' ;
30
+ protected $ description = 'Start the dump server to collect dump information. ' ;
31
31
32
- /** @var DumpServer */
32
+ /**
33
+ * The Dump server.
34
+ *
35
+ * @var \Symfony\Component\VarDumper\Server\DumpServer
36
+ */
33
37
private $ server ;
34
38
35
39
/**
36
- * @var \Symfony\Component\VarDumper\Command\Descriptor\DumpDescriptorInterface[]
40
+ * DumpServerCommand constructor.
41
+ *
42
+ * @param \Symfony\Component\VarDumper\Server\DumpServer $server
43
+ * @return void
37
44
*/
38
- private $ descriptors ;
39
-
40
45
public function __construct (DumpServer $ server )
41
46
{
42
47
$ this ->server = $ server ;
43
48
44
- $ this ->descriptors = [
45
- 'cli ' => new CliDescriptor (new CliDumper ()),
46
- 'html ' => new HtmlDescriptor (new HtmlDumper ()),
47
- ];
48
-
49
49
parent ::__construct ();
50
50
}
51
51
52
+ /**
53
+ * Handle the command.
54
+ *
55
+ * @return void
56
+ */
52
57
public function handle ()
53
58
{
54
- $ io = new SymfonyStyle ($ this ->input , $ this ->output );
55
- $ format = $ this ->option ('format ' );
56
-
57
- if (! $ descriptor = $ this ->descriptors [$ format ] ?? null ) {
58
- throw new InvalidArgumentException (sprintf ('Unsupported format "%s". ' , $ format ));
59
+ switch ($ format = $ this ->option ('format ' )) {
60
+ case 'cli ' :
61
+ $ descriptor = new CliDescriptor (new CliDumper );
62
+ break ;
63
+ case 'html ' :
64
+ $ descriptor = new HtmlDescriptor (new HtmlDumper );
65
+ break ;
66
+ default :
67
+ throw new InvalidArgumentException (sprintf ('Unsupported format "%s". ' , $ format ));
59
68
}
60
69
70
+ $ io = new SymfonyStyle ($ this ->input , $ this ->output );
71
+
61
72
$ errorIo = $ io ->getErrorStyle ();
62
73
$ errorIo ->title ('Laravel Var Dump Server ' );
63
74
0 commit comments