src/Rocketeer/Services/Connections/ConnectionsHandler.php
public function setCurrentConnection($connection = null, $server = null)
    {
        $connectionKey = $connection instanceof ConnectionKey ? $connection : $this->credentials->createConnectionKey($connection, $server);
        if ($this->current === $connectionKey->toHandle()) {
            return;
        }

        $this->current = $connectionKey->toHandle();
        $this->available = $this->getConnections()->map(function (ConnectionInterface $connection) use ($connectionKey) {
            $isCurrent = $connectionKey->is($connection->getConnectionKey());
            $connection->setCurrent($isCurrent);

            return $connection;
        });

        // Update events
        $this->bootstrapper->bootstrapUserCode();
    }
public function setCurrentConnection($connection = null, $server = null)
    {
        $connectionKey = $connection instanceof ConnectionKey ? $connection : $this->credentials->createConnectionKey($connection, $server);
        if ($this->current === $connectionKey->toHandle()) {
            return;
        }

        $this->current = $connectionKey->toHandle();
        $this->available = $this->getConnections()->map(function (ConnectionInterface $connection) use ($connectionKey) {
            $isCurrent = $connectionKey->is($connection->getConnectionKey());
            $connection->setCurrent($isCurrent);

            return $connection;
        });

        // Update events
        $this->bootstrapper->bootstrapUserCode();
    }
public function setCurrentConnection ( $ connection = null , $ server = null ) { $ connectionKey = $ connection instanceof ConnectionKey ? $ connection : $ this -> credentials -> createConnectionKey ( $ connection , $ server ) ; if ( $ this -> current === $ connectionKey -> toHandle ( ) ) { return ; } $ this -> current = $ connectionKey -> toHandle ( ) ; $ this -> available = $ this -> getConnections ( ) -> map ( function ( ConnectionInterface $ connection ) use ( $ connectionKey ) { $ isCurrent = $ connectionKey -> is ( $ connection -> getConnectionKey ( ) ) ; $ connection -> setCurrent ( $ isCurrent ) ; return $ connection ; } ) ; // Update events $ this -> bootstrapper -> bootstrapUserCode ( ) ; }
Set the current connection.

@param ConnectionKey|string $connection
@param int|null             $server
Set the current connection .