diff --git a/src/Illuminate/Foundation/Console/ServeCommand.php b/src/Illuminate/Foundation/Console/ServeCommand.php index f64cbe300382..fc40abc776b2 100644 --- a/src/Illuminate/Foundation/Console/ServeCommand.php +++ b/src/Illuminate/Foundation/Console/ServeCommand.php @@ -280,9 +280,7 @@ protected function flushOutputBuffer() ->map(fn ($line) => trim($line)) ->filter() ->each(function ($line) { - $stringable = new Stringable($line); - - if ($stringable->contains('Development Server (http')) { + if ((new Stringable($line))->contains('Development Server (http')) { if ($this->serverRunningHasBeenDisplayed === false) { $this->serverRunningHasBeenDisplayed = true; @@ -295,19 +293,23 @@ protected function flushOutputBuffer() return; } - $requestPort = static::getRequestPortFromLine($line); + if ((new Stringable($line))->contains(' Accepted')) { + $requestPort = static::getRequestPortFromLine($line); - if ($stringable->contains(' Accepted')) { $this->requestsPool[$requestPort] = [ $this->getDateFromLine($line), $this->requestsPool[$requestPort][1] ?? false, microtime(true), ]; - } elseif ($stringable->contains([' [200]: GET '])) { + } elseif ((new Stringable($line))->contains([' [200]: GET '])) { + $requestPort = static::getRequestPortFromLine($line); + $this->requestsPool[$requestPort][1] = trim(explode('[200]: GET', $line)[1]); - } elseif ($stringable->contains('URI:')) { + } elseif ((new Stringable($line))->contains('URI:')) { + $requestPort = static::getRequestPortFromLine($line); + $this->requestsPool[$requestPort][1] = trim(explode('URI: ', $line)[1]); - } elseif ($stringable->contains(' Closing')) { + } elseif ((new Stringable($line))->contains(' Closing')) { $requestPort = static::getRequestPortFromLine($line); if (empty($this->requestsPool[$requestPort])) { @@ -338,11 +340,11 @@ protected function flushOutputBuffer() $this->output->write(' '.str_repeat('.', $dots)); $this->output->writeln(" ~ {$runTime}"); - } elseif ($stringable->contains(['Closed without sending a request', 'Failed to poll event'])) { + } elseif ((new Stringable($line))->contains(['Closed without sending a request', 'Failed to poll event'])) { // ... } elseif (! empty($line)) { - if ($stringable->startsWith('[')) { - $line = $stringable->after('] '); + if ((new Stringable($line))->startsWith('[')) { + $line = (new Stringable($line))->after('] '); } $this->output->writeln(" $line");