Get the Session ID from the Cookie.

@param \Ratchet\ConnectionInterface $connection
@return string
166668
protected function getSessionIdFromCookie(Connection $connection)
    {
        $cookie = urldecode($connection->WebSocket->request->getCookie(config('session.cookie')));
        
        return $cookie ? Crypt::decrypt($cookie) : null;
    }
327397
protected function getQueue($connection)
	{
		if (is_null($connection))
		{
			$connection = $this->flyphp['config']['queue.default'];
		}

		$queue = $this->flyphp['config']->get("queue.connections.{$connection}.queue", 'default');

		return $this->input->getOption('queue') ?: $queue;
	}
586119
public function sessionID($id = null)
    {
        $current = Arr::get($_COOKIE, HttpCache::$sessionName, '');

        if ($id === null)
        {
            return $current;
        }

        $this->setCookie(HttpCache::$sessionName, $id
            , ini_get('session.cookie_lifetime')
            , ini_get('session.cookie_path')
            , ini_get('session.cookie_domain')
            , ini_get('session.cookie_secure')
            , ini_get('session.cookie_httponly'));
        $_COOKIE[HttpCache::$sessionName] = $id;
        return $current;
    }
967868
protected function getUser(Connection $connection)
    {
        $recaller = $connection->WebSocket->request->getCookie(Auth::getRecallerName());
        
        if (! $recaller) {
            return false;
        }
        
        try {
            $recaller = $this->Encrypter->decrypt(urldecode($recaller));
        } catch (Exception $e) {
            $recaller = $this->Encrypter->decrypt($recaller);
        }
        
        $id = explode('|', $recaller, 2)[0];
        $model = $this->getUserModel();
        
        return $model::find($id) !== null ? $id : false;
    }
473214
protected static function useCustomGrammar($connection)
    {
        // just for MySqlGrammar
        if (get_class($connection) === 'Illuminate\Database\MySqlConnection') {
            $MySqlGrammar = $connection->withTablePrefix(new MySqlGrammar);
            $connection->setSchemaGrammar($MySqlGrammar);
        }

        return $connection->getSchemaBuilder();
    }
1289481
public static String getClientId(Connection connection) {
        String clientId = null;
        
        try {
            clientId = connection == null ? null : connection.getClientID();
        } catch (JMSException e) {}
        
        return clientId;
    }
715038
public function getSessionIdFromCookie()
	{
		// get session id key name
		$client = 'site';
		if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'])
		{
			$referrer = $_SERVER['HTTP_REFERER'];
			if (\Hubzero\Utility\Uri::isInternal($referrer))
			{
				if (substr($referrer, 0, strlen('http')) == 'http')
				{
					$referrer = parse_url($referrer, PHP_URL_PATH);
				}
				$referrer = trim($referrer, '/');
				$parts = explode('/', $referrer);
				$referrer = array_shift($parts);
				if ($referrer == 'administrator')
				{
					$client = $referrer;
				}
			}
		}
		$sessionName = md5(\App::hash($client));

		// return session id stored in cookie
		return (!empty($_COOKIE[$sessionName])) ? $_COOKIE[$sessionName] : null;
	}
334912
public static function castIdentifier(ClassMetadata $targetEntity, Connection $connection)
    {
        if (!isset(self::$cacheCastIdentifiers[$targetEntity->getName()])) {
            $cast = '';

            if ($connection->getDriver() instanceof PgSqlDriver) {
                $type = self::getIdentifierType($targetEntity);
                $cast = '::'.$type->getSQLDeclaration(
                    $targetEntity->getIdentifierFieldNames(),
                    $connection->getDatabasePlatform()
                );
            }

            self::$cacheCastIdentifiers[$targetEntity->getName()] = $cast;
        }

        return self::$cacheCastIdentifiers[$targetEntity->getName()];
    }
1280209
private function getConnectionData(array $connection, $driver)
    {
        $connection = $this->replaceKeyIfExists($connection, 'database', $driver === 'pdo_sqlite' ? 'path' : 'dbname');
        $connection = $this->replaceKeyIfExists($connection, 'username', 'user');

        return array_merge($this->getFilteredConfig(), $connection);
    }
1204751
protected function getDatabaseSize($connection)
    {
        switch ($this->getDriverName($connection)) {
            case 'mysql':
                $size = $this->checkMySqlDatabaseSize($connection);
                break;
            case 'sqlite':
                $size = $this->checkSqLiteDatabaseSize($connection);
                break;
            case 'pgsql':
                $size = $this->checkPostgresDatabaseSize($connection);
                break;
            case 'sqlsrv':
                $size = $this->checkSqlServerDatabaseSize($connection);
                break;
            default:
                $this->eye->logger()->debug('Unable to find DB driver for size', $connection);
                return -1;
        }

        return round($size/1024/1024, 2);
    }
213134
static int getRegisteredID (Connection connection, Object object) {
		ObjectSpace[] instances = ObjectSpace.instances;
		for (int i = 0, n = instances.length; i < n; i++) {
			ObjectSpace objectSpace = instances[i];
			// Check if the connection is in this ObjectSpace.
			Connection[] connections = objectSpace.connections;
			for (int j = 0; j < connections.length; j++) {
				if (connections[j] != connection) continue;
				// Find an ID with the object.
				int id = objectSpace.objectToID.get(object, Integer.MAX_VALUE);
				if (id != Integer.MAX_VALUE) return id;
			}
		}
		return Integer.MAX_VALUE;
	}
597886
public function getProposedSessionId()
    {

        // if no session has already been load, initialize the session manager
        /** @var \AppserverIo\Appserver\ServletEngine\SessionManagerInterface $manager */
        $manager = $this->getContext()->search(SessionManagerInterface::IDENTIFIER);

        // if no session manager was found, we don't support sessions
        if ($manager == null) {
            return;
        }

        // if we can't find a requested session name, we try to load the default session cookie
        if ($this->getRequestedSessionName() == null) {
            $this->setRequestedSessionName($manager->getSessionSettings()->getSessionName());
        }

        // load the requested session ID and name
        $sessionName = $this->getRequestedSessionName();
        $id = $this->getRequestedSessionId();

        // try to load session ID from session cookie of request/response
        $cookieFound = null;
        if ($id == null && $this->getResponse()->hasCookie($sessionName)) {
            $cookieFound = $this->getResponse()->getCookie($sessionName);
        } elseif ($id == null && $this->hasCookie($sessionName)) {
            $cookieFound = $this->getCookie($sessionName);
        }

        // check if we can find a cookie
        if (is_array($cookieFound)) {
            // iterate over the cookies and try to find one that is not expired
            foreach ($cookieFound as $cookie) {
                if ($cookie instanceof CookieInterface && $cookie->isExpired() === false) {
                    $this->setRequestedSessionId($id = $cookie->getValue());
                }
            }

        // if we found a single cookie instance
        } elseif ($cookieFound instanceof CookieInterface && $cookieFound->isExpired() === false) {
            $this->setRequestedSessionId($id = $cookieFound->getValue());
        }

        // return the requested session
        return $id;
    }
379586
protected function handle(Connection $connection, $request)
    {
        $this->loadSession($connection);
        
        return $this->Kernel->handle($request);
    }
1163062
public function connection($connection = null)
    {
        if ($connection === null) {
            if ($this->connection === null) {
                $this->connection = ConnectionManager::get($this->options['connection']);
            }
            return $this->connection;
        }

        return $this->connection = $connection;
    }
945010
protected function prepare(Connection $connection)
	{
		$connection->setFetchMode($this->app['config']['database.fetch']);

		if ($this->app->bound('events'))
		{
			$connection->setEventDispatcher($this->app['events']);
		}

		// Here we'll set a reconnector callback. This reconnector can be any callable
		// so we will set a Closure to reconnect from this manager with the name of
		// the connection, which will allow us to reconnect from the connections.
		$connection->setReconnector(function($connection)
		{
			$this->reconnect($connection->getName());
		});

		return $connection;
	}
409773
public function getPresenceVerifierFor($connection)
    {
        return tap($this->getPresenceVerifier(), function ($verifier) use ($connection) {
            $verifier->setConnection($connection);
        });
    }
1027337
protected function getSessionId(Session $session)
	{
		$driver = $session->getDriver();

		if ( $driver instanceof Selenium2Driver ) {
			return $driver->getWebDriverSessionId();
		}

		throw new \RuntimeException('Unsupported session driver');
	}