@@ -20,44 +20,55 @@ class DumpServerCommand extends Command
2020 *
2121 * @var string
2222 */
23- protected $ signature = 'dump-server {--format=cli : The output format (cli,html)} ' ;
23+ protected $ signature = 'dump-server {--format=cli : The output format (cli,html). } ' ;
2424
2525 /**
2626 * The console command description.
2727 *
2828 * @var string
2929 */
30- protected $ description = 'Start the dump server to collect dump information ' ;
30+ protected $ description = 'Start the dump server to collect dump information. ' ;
3131
32- /** @var DumpServer */
32+ /**
33+ * The Dump server.
34+ *
35+ * @var \Symfony\Component\VarDumper\Server\DumpServer
36+ */
3337 private $ server ;
3438
3539 /**
36- * @var \Symfony\Component\VarDumper\Command\Descriptor\DumpDescriptorInterface[]
40+ * DumpServerCommand constructor.
41+ *
42+ * @param \Symfony\Component\VarDumper\Server\DumpServer $server
43+ * @return void
3744 */
38- private $ descriptors ;
39-
4045 public function __construct (DumpServer $ server )
4146 {
4247 $ this ->server = $ server ;
4348
44- $ this ->descriptors = [
45- 'cli ' => new CliDescriptor (new CliDumper ()),
46- 'html ' => new HtmlDescriptor (new HtmlDumper ()),
47- ];
48-
4949 parent ::__construct ();
5050 }
5151
52+ /**
53+ * Handle the command.
54+ *
55+ * @return void
56+ */
5257 public function handle ()
5358 {
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 ));
5968 }
6069
70+ $ io = new SymfonyStyle ($ this ->input , $ this ->output );
71+
6172 $ errorIo = $ io ->getErrorStyle ();
6273 $ errorIo ->title ('Laravel Var Dump Server ' );
6374
0 commit comments