Platformsh\Cli\Command\Tunnel\TunnelCommandBase::isTunnelOpen PHP Method

isTunnelOpen() protected method

Check whether a tunnel is already open.
protected isTunnelOpen ( array $tunnel ) : boolean | array
$tunnel array
return boolean | array
    protected function isTunnelOpen(array $tunnel)
    {
        foreach ($this->getTunnelInfo() as $info) {
            if ($this->tunnelsAreEqual($tunnel, $info)) {
                if (isset($info['pid']) && function_exists('posix_kill') && !posix_kill($info['pid'], 0)) {
                    $this->debug(sprintf('The tunnel at port %d is no longer open, removing from list', $info['localPort']));
                    $this->closeTunnel($info);
                    continue;
                }
                return $info;
            }
        }
        return false;
    }