File tree Expand file tree Collapse file tree 3 files changed +54
-9
lines changed Expand file tree Collapse file tree 3 files changed +54
-9
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,11 @@ public function handle()
3030 {
3131 $ server = $ this ->option ('server ' ) ?: config ('octane.server ' );
3232
33- return $ server == 'swoole '
34- ? $ this ->reloadSwooleServer ()
35- : $ this ->reloadRoadRunnerServer ();
33+ return match ($ server ) {
34+ 'swoole ' => $ this ->reloadSwooleServer (),
35+ 'roadrunner ' => $ this ->reloadRoadRunnerServer (),
36+ default => $ this ->invalidServer ($ server ),
37+ };
3638 }
3739
3840 /**
@@ -78,4 +80,17 @@ protected function reloadRoadRunnerServer()
7880
7981 return 0 ;
8082 }
83+
84+ /**
85+ * Inform the user that the server type is invalid.
86+ *
87+ * @param string $server
88+ * @return int
89+ */
90+ protected function invalidServer (string $ server )
91+ {
92+ $ this ->error ("Invalid server: {$ server }. " );
93+
94+ return 1 ;
95+ }
8196}
Original file line number Diff line number Diff line change @@ -45,9 +45,11 @@ public function handle()
4545
4646 $ server = $ this ->option ('server ' ) ?: config ('octane.server ' );
4747
48- return $ server == 'swoole '
49- ? $ this ->startSwooleServer ()
50- : $ this ->startRoadRunnerServer ();
48+ return match ($ server ) {
49+ 'swoole ' => $ this ->startSwooleServer (),
50+ 'roadrunner ' => $ this ->startRoadRunnerServer (),
51+ default => $ this ->invalidServer ($ server ),
52+ };
5153 }
5254
5355 /**
@@ -82,4 +84,17 @@ protected function startRoadRunnerServer()
8284 '--watch ' => $ this ->option ('watch ' ),
8385 ]);
8486 }
87+
88+ /**
89+ * Inform the user that the server type is invalid.
90+ *
91+ * @param string $server
92+ * @return int
93+ */
94+ protected function invalidServer (string $ server )
95+ {
96+ $ this ->error ("Invalid server: {$ server }. " );
97+
98+ return 1 ;
99+ }
85100}
Original file line number Diff line number Diff line change @@ -32,9 +32,11 @@ public function handle()
3232 {
3333 $ server = $ this ->option ('server ' ) ?: config ('octane.server ' );
3434
35- return $ server == 'swoole '
36- ? $ this ->stopSwooleServer ()
37- : $ this ->stopRoadRunnerServer ();
35+ return match ($ server ) {
36+ 'swoole ' => $ this ->stopSwooleServer (),
37+ 'roadrunner ' => $ this ->stopRoadRunnerServer (),
38+ default => $ this ->invalidServer ($ server ),
39+ };
3840 }
3941
4042 /**
@@ -88,4 +90,17 @@ protected function stopRoadRunnerServer()
8890
8991 return 0 ;
9092 }
93+
94+ /**
95+ * Inform the user that the server type is invalid.
96+ *
97+ * @param string $server
98+ * @return int
99+ */
100+ protected function invalidServer (string $ server )
101+ {
102+ $ this ->error ("Invalid server: {$ server }. " );
103+
104+ return 1 ;
105+ }
91106}
You can’t perform that action at this time.
0 commit comments