Exemple #1
0
 /**
  * Returns the file system for the given name
  *
  * @param string $name Key for the file system
  * @return \Aimeos\MW\Filesystem\Iface File system object
  * @throws \Aimeos\MW\Filesystem\Exception If an no configuration for that name is found
  */
 public function get($name)
 {
     $conf = (array) $this->getConfig($name);
     if (!isset($this->objects[$name])) {
         $this->objects[$name] = \Aimeos\MW\Filesystem\Factory::create($conf);
     }
     return $this->objects[$name];
 }
 /**
  * Returns the file system provider
  *
  * @return \League\Flysystem\FilesystemInterface File system provider
  */
 protected function getProvider()
 {
     if (!isset($this->fs)) {
         $config = $this->getConfig();
         if (!isset($config['source'])) {
             throw new Exception(sprintf('Configuration option "%1$s" missing', 'source'));
         }
         if (!isset($config['replica'])) {
             throw new Exception(sprintf('Configuration option "%1$s" missing', 'replica'));
         }
         $source = Factory::create((array) $config['source'])->getAdapter();
         $replica = Factory::create((array) $config['replica'])->getAdapter();
         $this->fs = new Filesystem(new ReplicateAdapter($source, $replica));
     }
     return $this->fs;
 }