public function bootRestResources(RouteCollector $collector, ContainerInterface $container) { $container->eachMarked(function (RestResource $resource, BindingInterface $binding) use($collector) { $collector->addMountHandler($resource->name, $resource->pattern, ResourceMountHandler::class, [$binding->getTypeName()]); }); }
public function createView(Configuration $config, ContainerInterface $container) { $view = new View(); $container->eachMarked(function (ViewRendererFactory $factory, BindingInterface $binding) use($view, $container) { $view->registerFactory($container->getBound($binding)); }); return $view; }
public function createExpressionContextFactory(ContainerInterface $container) { $factory = new ExpressionContextFactory(); $container->eachMarked(function (ExpressionExtension $extension, BindingInterface $binding) use($factory, $container) { $factory->registerExtension($container->getBound($binding)); }); $container->eachMarked(function (ExpressionResolver $resolver, BindingInterface $binding) use($factory, $container) { $factory->getResolvers()->registerResolver($container->getBound($binding)); }); return $factory; }