/** * @inheritDoc */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $config = $container->get('config'); $pathStackResolver = new PathStackResolver(); $paths = array(); if (isset($config['asset_manager']['resolver_configs']['paths'])) { $paths = $config['asset_manager']['resolver_configs']['paths']; } $pathStackResolver->addPaths($paths); return $pathStackResolver; }
/** * {@inheritDoc} * * @return PathStackResolver */ public function createService(ServiceLocatorInterface $serviceLocator) { $config = $serviceLocator->get('config'); $pathStackResolver = new PathStackResolver(); $paths = array(); if (isset($config['asset_manager']['resolver_configs']['paths'])) { $paths = $config['asset_manager']['resolver_configs']['paths']; } $pathStackResolver->addPaths($paths); return $pathStackResolver; }
public function testConstructor() { $resolver = new PathStackResolver(); $this->assertEmpty($resolver->getPaths()->toArray()); $resolver->addPaths(array(__DIR__)); $this->assertEquals(array(__DIR__ . DIRECTORY_SEPARATOR), $resolver->getPaths()->toArray()); $resolver->clearPaths(); $this->assertEquals(array(), $resolver->getPaths()->toArray()); $this->assertTrue($resolver instanceof MimeResolverAwareInterface); $this->assertTrue($resolver instanceof ResolverInterface); $mimeResolver = new MimeResolver(); $resolver->setMimeResolver($mimeResolver); $this->assertEquals($mimeResolver, $resolver->getMimeResolver()); }