diff --git a/packages/framework/src/Console/Commands/ServeCommand.php b/packages/framework/src/Console/Commands/ServeCommand.php index e9c006221a1..75240db7004 100644 --- a/packages/framework/src/Console/Commands/ServeCommand.php +++ b/packages/framework/src/Console/Commands/ServeCommand.php @@ -81,14 +81,14 @@ protected function printStartMessage(): void { $this->useBasicOutput() ? $this->output->writeln('Starting the HydeRC server... Press Ctrl+C to stop') - : ConsoleOutput::printStartMessage($this->getHostSelection(), $this->getPortSelection()); + : $this->console->printStartMessage($this->getHostSelection(), $this->getPortSelection()); } protected function getOutputHandler(): Closure { return $this->useBasicOutput() ? function (string $type, string $line): void { $this->output->write($line); - } : ConsoleOutput::getFormatter($this->output->isVerbose()); + } : $this->console->getFormatter(); } protected function useBasicOutput(): bool diff --git a/packages/realtime-compiler/src/ConsoleOutput.php b/packages/realtime-compiler/src/ConsoleOutput.php index b206c645a1b..5a723f714fe 100644 --- a/packages/realtime-compiler/src/ConsoleOutput.php +++ b/packages/realtime-compiler/src/ConsoleOutput.php @@ -22,7 +22,7 @@ public function __construct(bool $verbose = false) $this->verbose = $verbose; } - public static function printStartMessage(string $host, int $port): void + public function printStartMessage(string $host, int $port): void { $title = 'HydePHP Realtime Compiler'; $version = ' v'.Hyde::version(); @@ -50,12 +50,10 @@ public static function printStartMessage(string $host, int $port): void HTML); } - public static function getFormatter(bool $verbose): Closure + public function getFormatter(): Closure { - $console = (new static($verbose)); - - return function (string $type, string $line) use ($console): void { - $console->handleOutput($line); + return function (string $type, string $line): void { + $this->handleOutput($line); }; }