Exemplo n.º 1
0
 /**
  * Initialize resource locator by using the configuration.
  *
  * @param UniformResourceLocator $locator
  */
 public function initializeLocator(UniformResourceLocator $locator)
 {
     $locator->reset();
     $schemes = (array) $this->get('streams.schemes', []);
     foreach ($schemes as $scheme => $config) {
         if (isset($config['paths'])) {
             $locator->addPath($scheme, '', $config['paths']);
         }
         if (isset($config['prefixes'])) {
             foreach ($config['prefixes'] as $prefix => $paths) {
                 $locator->addPath($scheme, $prefix, $paths);
             }
         }
     }
 }
Exemplo n.º 2
0
 public function add(array $schemes)
 {
     foreach ($schemes as $scheme => $config) {
         if (isset($config['paths'])) {
             $this->locator->addPath($scheme, '', $config['paths']);
         }
         if (isset($config['prefixes'])) {
             foreach ($config['prefixes'] as $prefix => $paths) {
                 $this->locator->addPath($scheme, $prefix, $paths);
             }
         }
         $type = !empty($config['type']) ? $config['type'] : 'ReadOnlyStream';
         if ($type[0] != '\\') {
             $type = '\\Rockettheme\\Toolbox\\StreamWrapper\\' . $type;
         }
         $this->schemes[$scheme] = $type;
     }
 }
Exemplo n.º 3
0
 protected function init(Container $container, UniformResourceLocator $locator)
 {
     /** @var Config $config */
     $config = $container['config'];
     $schemes = (array) $config->get('streams.schemes', []);
     foreach ($schemes as $scheme => $config) {
         if (isset($config['paths'])) {
             $locator->addPath($scheme, '', $config['paths']);
         }
         if (isset($config['prefixes'])) {
             foreach ($config['prefixes'] as $prefix => $paths) {
                 $locator->addPath($scheme, $prefix, $paths);
             }
         }
         $type = !empty($config['type']) ? $config['type'] : 'ReadOnlyStream';
         if ($type[0] != '\\') {
             $type = '\\RocketTheme\\Toolbox\\StreamWrapper\\' . $type;
         }
         $this->schemes[$scheme] = $type;
     }
 }