public static function adapter($name) { $class = 'Dmyers\\Storage\\Adapter\\' . $name; if (!class_exists($class)) { throw new \InvalidArgumentException("Storage adapter {$name} does not exist."); } $adapter = new $class(); return $adapter; }