Skip to content
tristanlins edited this page Mar 6, 2013 · 3 revisions
Filesystem::create()
                ->getConfig() // return Config "{ $context = '' }"
                ->set(Config::STREAM_SUPPORTED, true)
                
                ->addAdapter('LocalAdapter', $local1, '/mnt1') // return ConfigContext{ $context = $local1 }
                ->set(...)
                
                ->select(null) // return Config "{ $context = '' }"
                ->addAdapter('MergedAdapter', $merge1, '/merged', null) // return ConfigContext{ $context = $merge1 }
                ->set(...)
                
                ->addAdapter('LocalAdapter', 'local2', '/merged', 'merge1') // return ConfigContext{ $context = 'local2'}
                ->set(...)
                
                ->select($merge1) // return ConfigContext{ $context = $merge1 }
                ->addAdapter('LocalAdapter', 'local4', '/merged/sub2') // return ConfigContext{ $context = 'local4' }
                ->set(...)
                
                ->select() // return Config "{ $context = '' }"
                ->addAdapter('LocalAdapter', 'local3', '/merged/sub1') // return ConfigContext{ $context = 'local3' }
                ->set(...)
                
                ->select(null) // return Config "{ $context = '' }"
                ->addAdapter('LocalAdapter', 'local5', '/', $local1) // return ConfigContext{ $context = 'local5' }
                ->set(...)
                
                ->commit();
$config = $fs->getConfig();

foreach (......) {
    $config
      [ ->select(...) ]
        ->addAdapter(...)
        ...
}
$cfg = $fs->getConfig();
$cfg->select($name)->set(...)->set(...)->set(...);

foreach($cfg->getAdapters() as $name => $config) {
    $cfg->select($name)
        ->set(...)->set(...)->set(...)
}
/ <- RootAdapter extends MountAdapter; name = null/''
/mnt1 <- LocalAdapter; name = local1
/merged <- MergedAdapter extends MountAdapter; name = merge1
/merged <- addAdapter(LocalAdapter, '', 'local2', 'merge1')
/merged/sub1 <- addAdapter(LocalAdapter, '/merged/sub1', 'local3', null)
/merged/sub2 <- addAdapter(LocalAdapter, '/sub2', 'local4', 'merge1')
/ <- LocalAdapter; name = local5; parent = null, insert = local1

```php
$myXMLConfig = '...'
$cfg = new FilesystemXMLConfigurator();
$cfg->config(new Filesystem(), $myXMLConfig);
Clone this wiki locally