コード例 #1
0
 public function testSetResourceCollector()
 {
     $loader = new ExampleFileLoader(new FileLocator());
     $this->resolver->addLoader($loader);
     $this->resolver->setResourceCollector($this->collector);
     $this->assertSame($this->collector, $loader->getResourceCollector());
 }
コード例 #2
0
ファイル: Wise.php プロジェクト: roberto-slopez/Silex-ReactJS
 /**
  * Creates a pre-configured instance of Wise.
  *
  * @param array|string $paths The configuration directory path(s).
  * @param string       $cache The cache directory path.
  * @param boolean      $debug Enable debugging?
  *
  * @return Wise The instance.
  */
 public static function create($paths, $cache = null, $debug = false)
 {
     $wise = new self($debug);
     if ($cache) {
         $wise->setCacheDir($cache);
     }
     $locator = new FileLocator($paths);
     $resolver = new LoaderResolver(array(new Loader\IniFileLoader($locator), new Loader\JsonFileLoader($locator), new Loader\PhpFileLoader($locator), new Loader\XmlFileLoader($locator), new Loader\YamlFileLoader($locator)));
     $wise->setCollector(new Resource\ResourceCollector());
     $wise->setLoader(new DelegatingLoader($resolver));
     $resolver->setResourceCollector($wise->getCollector());
     $resolver->setWise($wise);
     return $wise;
 }