AssetManager\Service\AggregateResolverServiceFactory::__invoke PHP Method

__invoke() public method

public __invoke ( Interop\Container\ContainerInterface $container, $requestedName, array $options = null )
$container Interop\Container\ContainerInterface
$options array
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        $config = $container->get('config');
        $config = isset($config['asset_manager']) ? $config['asset_manager'] : array();
        $resolver = new AggregateResolver();
        if (empty($config['resolvers'])) {
            return $resolver;
        }
        foreach ($config['resolvers'] as $resolverService => $priority) {
            $resolverService = $container->get($resolverService);
            if (!$resolverService instanceof ResolverInterface) {
                throw new Exception\RuntimeException('Service does not implement the required interface ResolverInterface.');
            }
            if ($resolverService instanceof AggregateResolverAwareInterface) {
                $resolverService->setAggregateResolver($resolver);
            }
            if ($resolverService instanceof MimeResolverAwareInterface) {
                $resolverService->setMimeResolver($container->get(MimeResolver::class));
            }
            if ($resolverService instanceof AssetFilterManagerAwareInterface) {
                $resolverService->setAssetFilterManager($container->get(AssetFilterManager::class));
            }
            $resolver->attach($resolverService, $priority);
        }
        return $resolver;
    }
AggregateResolverServiceFactory