src/Neutrino/Foundation/Cli/Tasks/ServerTask.php
private function getPort($host)
    {
        if ($this->hasOption('port')) {
            $port = $this->getOption('port');

            if(empty($port) || true === $port){
                throw new \Exception('Port can\'t be empty');
            }
            if ($this->portIsOpen($host, $port)) {
                throw new \Exception('Port [' . $port . '] on host [' . $host . '] is already used.');
            }
        } else {
            $port = $this->acquirePort($host);
        }

        return $port;
    }
private function getPort($host)
    {
        if ($this->hasOption('port')) {
            $port = $this->getOption('port');

            if(empty($port) || true === $port){
                throw new \Exception('Port can\'t be empty');
            }
            if ($this->portIsOpen($host, $port)) {
                throw new \Exception('Port [' . $port . '] on host [' . $host . '] is already used.');
            }
        } else {
            $port = $this->acquirePort($host);
        }

        return $port;
    }
@param $host

@return int|null|string
@throws \Exception