public static function getPort($start = 3000, $hostname = null, $end = null)
    {
        $end = $end ?: $start + 30;
        for ($port = $start; $port <= $end; $port++) {
            if (static::validatePort($port) && !static::isPortInUse($port, $hostname)) {
                return $port;
            }
        }
        throw new \Exception(sprintf('Failed to find an available port between %d and %d', $start, $end));
    }