/** * @param ContainerInterface $container */ protected function register(ContainerInterface $container) { $loop = $container->make('Kraken\\Loop\\LoopInterface'); $context = $container->make('Kraken\\Runtime\\RuntimeContextInterface'); $modelFactory = new ChannelModelFactory($context->getAlias(), $loop); $factory = new ChannelFactory($context->getAlias(), $modelFactory, $loop); $container->instance('Kraken\\Channel\\ChannelModelFactoryInterface', $modelFactory); $container->factory('Kraken\\Channel\\ChannelModelInterface', function () use($modelFactory) { return $modelFactory->create('Kraken\\Channel\\Model\\Null\\NullModel'); }); $container->instance('Kraken\\Channel\\ChannelFactoryInterface', $factory); $container->factory('Kraken\\Channel\\ChannelInterface', [$factory, 'create']); $container->factory('Kraken\\Channel\\ChannelCompositeInterface', [$factory, 'create']); }
/** * @param ContainerInterface $container */ protected function register(ContainerInterface $container) { $runtime = $container->make('Kraken\\Runtime\\RuntimeContainerInterface'); $factory = new SolverFactory($runtime); $config = []; $container->instance('Kraken\\Supervision\\SolverFactoryInterface', $factory); $container->factory('Kraken\\Supervision\\SupervisorInterface', function (SolverFactoryInterface $passedFactory = null, $passedConfig = [], $passedRules = []) use($factory, $config) { return new Supervisor($passedFactory !== null ? $passedFactory : $factory, array_merge($config, $passedConfig), $passedRules); }); }