/** * @param ContainerInterface $container */ protected function register(ContainerInterface $container) { $system = $container->make('Kraken\\Util\\System\\SystemInterface'); $core = $container->make('Kraken\\Core\\CoreInterface'); $config = $container->make('Kraken\\Config\\ConfigInterface'); $fs = $container->make('Kraken\\Filesystem\\FilesystemInterface'); $runtime = $container->make('Kraken\\Runtime\\RuntimeContainerInterface'); $channel = $container->make('Kraken\\Runtime\\Service\\ChannelInternal'); $this->registerRuntimeSupervision($runtime, $channel, $config); $context = $config->exists('context') ? ArraySupport::flatten($config->get('context')) : []; $defaultConfig = ['runtime' => $runtime, 'channel' => $channel, 'context' => $context, 'system' => $system, 'filesystem' => $fs, 'receiver' => $runtime->getParent()]; $factoryProcess = new ProcessManagerFactory(); $factoryThread = new ThreadManagerFactory(); if ($core->getType() === Runtime::UNIT_THREAD) { $factoryProcess->remove('Kraken\\Runtime\\Container\\Manager\\ProcessManagerBase'); } $managerProcess = $this->createManager($container, $factoryProcess, $defaultConfig, $config->get('runtime.manager.process')); $managerThread = $this->createManager($container, $factoryThread, $defaultConfig, $config->get('runtime.manager.thread')); $managerRuntime = new RuntimeManager($channel, $managerProcess, $managerThread); $container->instance('Kraken\\Runtime\\Container\\ProcessManagerInterface', $managerProcess); $container->instance('Kraken\\Runtime\\Container\\ThreadManagerInterface', $managerThread); $container->instance('Kraken\\Runtime\\RuntimeManagerInterface', $managerRuntime); }