Exemplo n.º 1
0
 /**
  * Make a new store.
  *
  * @param array $config
  *
  * @throws \InvalidArgumentException
  *
  * @return \AltThree\Storage\Stores\StoreInterface
  */
 public function make(array $config)
 {
     $config = $this->getConfig($config);
     $store = new FlysystemStore($this->flysystem->connection($config['main']));
     if ($config['fallback']) {
         $store = new FallbackStore($store, new FlysystemStore($this->flysystem->connection($config['fallback'])));
     }
     if ($config['compression']) {
         $store = new CompressingStore($store, $this->compressor);
     }
     if ($config['encryption']) {
         if ($config['compression']) {
             throw new InvalidArgumentException('Compression cannot be enabled at the same time as encryption.');
         }
         $store = new EncryptingStore($store, $this->encrypter);
     }
     if ($cache = $config['cache']) {
         $store = new CachingStore($store, $this->cache->store($cache === true ? null : $cache));
     }
     return $store;
 }
Exemplo n.º 2
0
 /**
  * Get a connection instance.
  *
  * @param string $name
  * @return object 
  * @static 
  */
 public static function connection($name = null)
 {
     //Method inherited from \GrahamCampbell\Manager\AbstractManager
     return \GrahamCampbell\Flysystem\FlysystemManager::connection($name);
 }