/** * Get a filesystem instance. * * @param string $name * @return \League\Flysystem\AdapterInterface */ private function resolveAdapter($name, $configs) { try { $adatperClass = $this->app->get('\\TitaPHP\\Filesystem\\' . ucfirst($name) . 'Adapter'); } catch (NotFoundException $e) { throw new \Exception("Filesystem driver {$name} could not be located"); } $adapter = $adatperClass->adapt($configs); if (!$adapter instanceof \League\Flysystem\AdapterInterface) { throw new \Exception('Adapter must be instance of \\League\\Flysystem\\AdapterInterface'); } return $adapter; }