src/Rocketeer/Services/Connections/ConnectionsHandler.php
public function setActiveConnections($connections)
    {
        if (!is_array($connections)) {
            $connections = explode(',', $connections);
        }

        // Sanitize and set connections
        $filtered = array_filter($connections, [$this, 'isValidConnection']);
        if (!$filtered) {
            throw new ConnectionException('Invalid connection(s): '.implode(', ', $connections));
        }

        $this->available = $this->getConnections()->map(function (ConnectionInterface $connection) use ($connections) {
            $connectionKey = $connection->getConnectionKey();
            $handle = $connectionKey->toHandle();

            $connection->setActive(in_array($handle, $connections, true) || in_array($connectionKey->name, $connections, true));
            $connection->setCurrent(false);

            return $connection;
        });
    }
public function setActiveConnections($connections)
    {
        if (!is_array($connections)) {
            $connections = explode(',', $connections);
        }

        // Sanitize and set connections
        $filtered = array_filter($connections, [$this, 'isValidConnection']);
        if (!$filtered) {
            throw new ConnectionException('Invalid connection(s): '.implode(', ', $connections));
        }

        $this->available = $this->getConnections()->map(function (ConnectionInterface $connection) use ($connections) {
            $connectionKey = $connection->getConnectionKey();
            $handle = $connectionKey->toHandle();

            $connection->setActive(in_array($handle, $connections, true) || in_array($connectionKey->name, $connections, true));
            $connection->setCurrent(false);

            return $connection;
        });
    }
public function setActiveConnections ( $ connections ) { if ( ! is_array ( $ connections ) ) { $ connections = explode ( ',' , $ connections ) ; } // Sanitize and set connections $ filtered = array_filter ( $ connections , [ $ this , 'isValidConnection' ] ) ; if ( ! $ filtered ) { throw new ConnectionException ( 'Invalid connection(s): ' . implode ( ', ' , $ connections ) ) ; } $ this -> available = $ this -> getConnections ( ) -> map ( function ( ConnectionInterface $ connection ) use ( $ connections ) { $ connectionKey = $ connection -> getConnectionKey ( ) ; $ handle = $ connectionKey -> toHandle ( ) ; $ connection -> setActive ( in_array ( $ handle , $ connections , true ) || in_array ( $ connectionKey -> name , $ connections , true ) ) ; $ connection -> setCurrent ( false ) ; return $ connection ; } ) ; }
Override the active connections.

@param string|string[] $connections

@throws ConnectionException
Override the active connections .