protected function selectStorage(DebugBar $debugbar)
{
$config = $this->config;
if ($config->storage->enabled) {
$driver = $config->storage->get('driver', 'file');
switch ($driver) {
case 'mongodb':
$connection = $config->storage->mongodb->connection;
$db = $config->storage->mongodb->db;
$options = $config->storage->mongodb->options;
$collection = $config->storage->mongodb->collection;
$storage = new MongoDB($connection, $db, $collection, $options);
break;
default:
$path = $config->storage->path;
$storage = new Filesystem($path);
break;
}
$debugbar->setStorage($storage);
}
}