src/Viserio/Component/WebServer/Command/ServerStatusCommand.php
public function handle(): int
    {
        if ($filter = $this->option('filter')) {
            if (WebServer::isRunning($this->option('pidfile'))) {
                [$host, $port] = \explode(':', $address = WebServer::getAddress($this->option('pidfile')));

                if ($filter === 'address') {
                    $this->line($address);
                } elseif ($filter === 'host') {
                    $this->line($host);
                } elseif ($filter === 'port') {
                    $this->line($port);
                } else {
                    throw new InvalidArgumentException(\sprintf('[%s] is not a valid filter.', $filter));
                }

                return 0;
            }
        }

        if (WebServer::isRunning($this->option('pidfile'))) {
            $this->getOutput()->success(\sprintf('Web server still listening on http://%s', WebServer::getAddress($this->option('pidfile'))));

            return 0;
        }

        $this->warn('No web server is listening.');

        return 1;
    }
public function handle(): int
    {
        if ($filter = $this->option('filter')) {
            if (WebServer::isRunning($this->option('pidfile'))) {
                [$host, $port] = \explode(':', $address = WebServer::getAddress($this->option('pidfile')));

                if ($filter === 'address') {
                    $this->line($address);
                } elseif ($filter === 'host') {
                    $this->line($host);
                } elseif ($filter === 'port') {
                    $this->line($port);
                } else {
                    throw new InvalidArgumentException(\sprintf('[%s] is not a valid filter.', $filter));
                }

                return 0;
            }
        }

        if (WebServer::isRunning($this->option('pidfile'))) {
            $this->getOutput()->success(\sprintf('Web server still listening on http://%s', WebServer::getAddress($this->option('pidfile'))));

            return 0;
        }

        $this->warn('No web server is listening.');

        return 1;
    }
{@inheritdoc}