diff --git a/packages/framework/src/Console/Commands/ServeCommand.php b/packages/framework/src/Console/Commands/ServeCommand.php index d4d88ba5cae..91499991738 100644 --- a/packages/framework/src/Console/Commands/ServeCommand.php +++ b/packages/framework/src/Console/Commands/ServeCommand.php @@ -57,30 +57,21 @@ protected function getExecutablePath(): string protected function runServerProcess(string $command): void { - $outputHandler = $this->useBasicOutput() ? $this->getDefaultOutputHandler() : $this->getFancyOutputHandler(); - - Process::forever()->run($command, $outputHandler); + Process::forever()->run($command, $this->getOutputHandler()); } protected function printStartMessage(): void { - if ($this->useBasicOutput()) { - $this->line('Starting the HydeRC server... Press Ctrl+C to stop'); - } else { - ConsoleOutput::printStartMessage($this->getHostSelection(), $this->getPortSelection()); - } + $this->useBasicOutput() + ? $this->line('Starting the HydeRC server... Press Ctrl+C to stop') + : ConsoleOutput::printStartMessage($this->getHostSelection(), $this->getPortSelection()); } - protected function getDefaultOutputHandler(): Closure + protected function getOutputHandler(): Closure { - return function (string $type, string $line): void { + return $this->useBasicOutput() ? function (string $type, string $line): void { $this->output->write($line); - }; - } - - protected function getFancyOutputHandler(): Closure - { - return ConsoleOutput::getFormatter($this->output->isVerbose()); + } : ConsoleOutput::getFormatter($this->output->isVerbose()); } protected function useBasicOutput(): bool