Kraken\Channel\ChannelFactory::__construct PHP Метод

__construct() публичный Метод

public __construct ( string $name, ChannelModelFactoryInterface $modelFactory, Kraken\Loop\LoopInterface $loop = null )
$name string
$modelFactory ChannelModelFactoryInterface
$loop Kraken\Loop\LoopInterface
    public function __construct($name, ChannelModelFactoryInterface $modelFactory, LoopInterface $loop = null)
    {
        parent::__construct();
        $factory = $this;
        $factory->bindParam('name', $name)->bindParam('encoder', new Encoder(new JsonParser()))->bindParam('router', function () {
            return new RouterComposite(['input' => new Router(), 'output' => new Router()]);
        })->bindParam('loop', $loop);
        $factory->define(Channel::class, function ($model, $config = []) use($factory, $modelFactory) {
            return new Channel(isset($config['name']) ? $config['name'] : $factory->getParam('name'), $modelFactory->create($model, [$config]), $factory->getParam('router'), $factory->getParam('encoder'), isset($config['loop']) ? $config['loop'] : $factory->getParam('loop'));
        })->define(ChannelComposite::class, function ($channels = [], $config = []) use($factory) {
            return new ChannelComposite(isset($config['name']) ? $config['name'] : $factory->getParam('name'), $channels, $factory->getParam('router'), isset($config['loop']) ? $config['loop'] : $factory->getParam('loop'));
        });
    }
ChannelFactory