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;
    }
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;
    }
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 ; }
Sets the client connection to elastic search when passed.
If no arguments are provided, it returns the current connection.

@param ProcessMQ\RabbitMQConnection|null $connection The conneciton to elastic search
@return ProcessMQ\RabbitMQConnection
Sets the client connection to elastic search when passed . If no arguments are provided it returns the current connection .