コード例 #1
0
 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()]);
     });
 }
コード例 #2
0
ファイル: Komponent.php プロジェクト: koolkode/http-komponent
 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;
 }
コード例 #3
0
ファイル: Komponent.php プロジェクト: koolkode/k2
 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;
 }