diff --git a/src/Dmyers/Storage/Storage.php b/src/Dmyers/Storage/Storage.php index f23c6c9..7e563e3 100644 --- a/src/Dmyers/Storage/Storage.php +++ b/src/Dmyers/Storage/Storage.php @@ -37,16 +37,24 @@ public static function instance($name = null) $name = static::config('default', 'Local'); } + $adapter = static::adapter($name); + + $instance = new static(); + $instance->setAdapter($adapter); + + return $instance; + } + + public static function adapter($name) + { $adapter = 'Dmyers\\Storage\\Adapter\\'.$name; if (!class_exists($adapter)) { throw new \InvalidArgumentException("Storage adapter {$name} does not exist."); } - $instance = new static(); $adapter = new $adapter(); - $instance->setAdapter($adapter); - return $instance; + return $adapter; } } \ No newline at end of file