Get Docker formatted service ports.

@param null $host

@return array
An array of Docker service ports.
350529
protected function getPorts($host = null)
    {
        $ports = $this->ports();
        array_walk($ports, function (&$port) use ($host) {
            $host = isset($host) ? $host : $port;
            $port = "{$host}:{$port}";
        });

        return $ports;
    }
1132249
public function host($host = null)
    {
        $this->host = empty($host) ? null : $host;

        return $this->host;
    }
346427
public function host($host = null)
    {
        if (func_num_args() === 0) {
            $scheme = $this->_classes['scheme'];
            $port = $scheme::port($this->_scheme) !== $this->_port ? $this->_port : null;
            return ($port !== null ? "{$this->_host}:{$port}" : $this->_host);
        }
        if (strpos($host, ':')) {
            list($host, $port) = explode(':', $host);
            $this->port($port);
        }
        $this->_host = $host;
        $headers = $this->headers();
        $headers->prepend('Host', $this->host());
        return $this;
    }
75713
public function setHost($host)
    {
        if ($host instanceof Binary && $host->getType() == Binary::TYPE_UUID) {
            return $this->{$this->createdByAttribute} = $host;
        }
        if ($host instanceof $this->hostClass || $host instanceof IdentityInterface) {
            return $this->{$this->createdByAttribute} = new Binary($host->getGUID(), Binary::TYPE_UUID);
        }
        if (is_string($host) && preg_match(Number::GUID_REGEX, $host)) {
            return $this->{$this->createdByAttribute} = new Binary(Number::guid_bin($host), Binary::TYPE_UUID);
        }
        if (strlen($host) == 16) {
            return $this->{$this->createdByAttribute} = new Binary($host, Binary::TYPE_UUID);
        }
        return false;
    }
831015
public function connectRaw($host)
    {
        $this->type = 'raw';
        if (@inet_pton($host) === false) { // dirty check
            \PHPDaemon\Clients\DNS\Pool::getInstance()->resolve($host, function ($result) use ($host) {
                if ($result === false) {
                    Daemon::log(get_class($this) . '->connectRaw : unable to resolve hostname: ' . $host);
                    $this->onFailureEv();
                    return;
                }
                // @TODO stack of addrs
                if (is_array($result)) {
                    srand(Daemon::$process->getPid());
                    $real = $result[rand(0, sizeof($result) - 1)];
                    srand();
                } else {
                    $real = $result;
                }
                $this->connectRaw($real);
            });
            return true;
        }
        $this->hostReal = $host;
        if ($this->host === null) {
            $this->host = $this->hostReal;
        }
        $this->addr = $this->hostReal . ':raw';
        $fd = socket_create(\EventUtil::AF_INET, \EventUtil::SOCK_RAW, 1);
        if (!$fd) {
            return false;
        }
        socket_set_nonblock($fd);
        @socket_connect($fd, $host, 0);
        $this->setFd($fd);
        if (!$this->bev) {
            return false;
        }
        return true;
    }
1230577
def get_host_port(spec, default_port):
    ""
    args = (spec.split(':', 1) + [default_port])[:2]
    args[1] = int(args[1])
    return args[0], args[1]
1102144
public function getPublicSuffix($host)
    {
        if (strpos($host, '.') === 0) {
            return null;
        }

        if (strpos($host, '.') === false) {
            return null;
        }

        $host = strtolower($host);
        $parts = array_reverse(explode('.', $host));
        $publicSuffix = array();
        $psl = $this->psl;

        foreach ($parts as $part) {
            if (array_key_exists($part, $psl)
                && array_key_exists('!', $psl[$part])) {
                break;
            }

            if (array_key_exists($part, $psl)) {
                array_unshift($publicSuffix, $part);
                $psl = $psl[$part];
                continue;
            }

            if (array_key_exists('*', $psl)) {
                array_unshift($publicSuffix, $part);
                $psl = $psl['*'];
                continue;
            }

            // Avoids improper parsing when $host's subdomain + public suffix === 
            // a valid public suffix (e.g. host 'us.example.com' and public suffix 'us.com')
            break;
        }

        // Apply algorithm rule #2: If no rules match, the prevailing rule is "*".
        if (empty($publicSuffix)) {
            $publicSuffix[0] = $parts[0];
        }

        return implode('.', array_filter($publicSuffix, 'strlen'));
    }
712881
public static function parse_socket_options(&$options, $host = null)
    {
        if (empty($host) || empty($options)) {
            return $options;
        }

        // get rid of schema and port from the hostname
        $host_url = parse_url($host);
        if (isset($host_url['host'])) {
            $host = $host_url['host'];
        }

        // find per-host options
        if (array_key_exists($host, $options)) {
            $options = $options[$host];
        }
    }
145079
public function getRender($host)
    {
        $index = $this->httpRoot[$host]['render'] ?? $this->httpRoot['default']['render'] ?? null;
        return $index;
    }
1210170
public function getHostRoot($host)
    {
        $root_path = $this->httpRoot[$host]['root'] ?? '';
        if (empty($root_path)) {
            $root_path = $this->httpRoot['default']['root'] ?? '';
        }
        if (!empty($root_path)) {
            $root_path = WWW_DIR . "/$root_path/";
        } else {
            $root_path = WWW_DIR . "/";
        }
        return $root_path;
    }
72743
public function findAll($host = null, callable $callback = null)
    {
        /** @var QueryBuilder $queryBuilder */
        $queryBuilder = $this->entityManager->createQueryBuilder();
        $query = $queryBuilder
            ->select('r')
            ->from($this->getEntityClassName(), 'r');

        if ($host !== null) {
            $query->andWhere('r.host = :host')
                ->setParameter('host', $host);
        } else {
            $query->andWhere('r.host IS NULL');
        }

        $query->orderBy('r.host', 'ASC');
        $query->addOrderBy('r.sourceUriPath', 'ASC');

        return $this->iterate($query->getQuery()->iterate(), $callback);
    }
1108076
public function create($host = null) : HttpServerDoc
    {
        $serverDoc = new HttpServerDoc();
        if (null !== $this->jsonRpcEndpoint) {
            $serverDoc->setEndpoint($this->jsonRpcEndpoint);
        }
        if (null !== $host) {
            $serverDoc->setHost($host);
        }

        $this->appendMethodsDoc($serverDoc);

        $event = new ServerDocCreatedEvent($serverDoc);
        $this->dispatcher->dispatch($event::EVENT_NAME, $event);

        return $serverDoc;
    }
8210
public function requiredPorts()
    {
        $ports = [];

        foreach ($this->getServiceInstances() as $info) {
            if (!isset($info['instance'])) {
                continue;
            }
            $instance = $info['instance'];

            if ($instance instanceof ServiceInterface) {
                $ports = array_merge($ports, $instance->getHostPorts());
            }
        }
        $ports = array_unique($ports);

        return array_values($ports);
    }
129927
public function show(string $host, array $params = [])
    {
        $path = $this->buildKnownHostsPath($host);

        return $this->get($path, $params);
    }
185927
function _filterHost($host)
    {
        if (strstr($host, ':') !== false)
            throw new \InvalidArgumentException('Host name can`t contains port number.');

        $host = strtolower($host);
        return $host;
    }
1112625
public static function hostParts($host = null) {
		if (empty($host)) {
			$host = self::host();
		}
		$host = str_replace(['http://', 'https://', '/'], '', $host);
		$temp = explode('.', $host);
		krsort($temp);
		$result = [];
		$counter = 1;
		foreach ($temp as $k => $v) {
			$result[$counter] = $v;
			$counter++;
		}
		return $result;
	}
110667
public function getDefinitionByHost($host)
    {
        $searchEngines = $this->getDefinitions();

        if (!array_key_exists($host, $searchEngines)) {
            return array();
        }

        return $searchEngines[$host];
    }