resolve() public method

Returns a loader able to load the resource.
public resolve ( mixed $resource ) : Symfony\Component\Routing\Loader\LoaderInterface | false
$resource mixed A resource
return Symfony\Component\Routing\Loader\LoaderInterface | false A LoaderInterface instance
Exemplo n.º 1
0
 /**
  * @covers Symfony\Component\Routing\Loader\LoaderResolver::resolve
  */
 public function testResolve()
 {
     $resolver = new LoaderResolver(array($loader = new ClosureLoader()));
     $this->assertFalse($resolver->resolve('foo.foo'), '->resolve() returns false if no loader is able to load the resource');
     $this->assertEquals($loader, $resolver->resolve(function () {
     }), '->resolve() returns the loader for the given resource');
 }
Exemplo n.º 2
0
 /**
  * Returns a loader able to load the resource.
  *
  * @param mixed  $resource A resource
  *
  * @return LoaderInterface A LoaderInterface instance
  */
 public function resolve($resource)
 {
     if (count($this->services)) {
         while ($id = array_shift($this->services)) {
             $this->addLoader($this->container->get($id));
         }
     }
     return parent::resolve($resource);
 }