/** * */ public function __construct() { parent::__construct(); $factory = $this; $factory->define('SelectLoop', function () { return new SelectLoop(); }); }
/** * */ public function __construct() { parent::__construct(); $adapters = ['Local' => 'Kraken\\Filesystem\\Factory\\LocalFactory', 'Ftp' => 'Kraken\\Filesystem\\Factory\\FtpFactory', 'Ftpd' => 'Kraken\\Filesystem\\Factory\\FtpdFactory', 'Null' => 'Kraken\\Filesystem\\Factory\\NullFactory', 'AwsS3v2' => 'Kraken\\Filesystem\\Factory\\Aws3v2Factory', 'AwsS3v3' => 'Kraken\\Filesystem\\Factory\\Aws3v3Factory', 'Rackspace' => 'Kraken\\Filesystem\\Factory\\RackspaceFactory', 'Dropbox' => 'Kraken\\Filesystem\\Factory\\DropboxFactory', 'Copy' => 'Kraken\\Filesystem\\Factory\\CopyFactory', 'Sftp' => 'Kraken\\Filesystem\\Factory\\SftpFactory', 'Zip' => 'Kraken\\Filesystem\\Factory\\ZipFactory', 'WebDAV' => 'Kraken\\Filesystem\\Factory\\WebDavFactory', 'Redis' => 'Kraken\\Filesystem\\Factory\\RedisFactory', 'Memory' => 'Kraken\\Filesystem\\Factory\\MemoryFactory']; foreach ($adapters as $name => $adapter) { $this->registerFactoryMethod($name, $adapter); } }
/** * @param RuntimeContainerInterface $runtime */ public function __construct(RuntimeContainerInterface $runtime) { parent::__construct(); $this->runtime = $runtime; $handlers = ['CmdDoNothing' => 'Kraken\\Runtime\\Supervision\\Cmd\\CmdDoNothing', 'CmdEscalate' => 'Kraken\\Runtime\\Supervision\\Cmd\\CmdEscalate', 'CmdSolve' => 'Kraken\\Runtime\\Supervision\\Cmd\\CmdSolve', 'CmdLog' => 'Kraken\\Runtime\\Supervision\\Cmd\\CmdLog', 'RuntimeContinue' => 'Kraken\\Runtime\\Supervision\\Runtime\\RuntimeContinue', 'RuntimeDestroy' => 'Kraken\\Runtime\\Supervision\\Runtime\\RuntimeDestroy', 'RuntimeDestroySoft' => 'Kraken\\Runtime\\Supervision\\Runtime\\RuntimeDestroySoft', 'RuntimeDestroyHard' => 'Kraken\\Runtime\\Supervision\\Runtime\\RuntimeDestroyHard', 'RuntimeRecreate' => 'Kraken\\Runtime\\Supervision\\Runtime\\RuntimeRecreate', 'RuntimeStart' => 'Kraken\\Runtime\\Supervision\\Runtime\\RuntimeStart', 'RuntimeStop' => 'Kraken\\Runtime\\Supervision\\Runtime\\RuntimeStop', 'ContainerContinue' => 'Kraken\\Runtime\\Supervision\\Container\\ContainerContinue', 'ContainerDestroy' => 'Kraken\\Runtime\\Supervision\\Container\\ContainerDestroy', 'ContainerStart' => 'Kraken\\Runtime\\Supervision\\Container\\ContainerStart', 'ContainerStop' => 'Kraken\\Runtime\\Supervision\\Container\\ContainerStop']; foreach ($handlers as $handlerName => $handlerClass) { $this->registerHandler($handlerName, $handlerClass); } }
/** * @param string[] $params */ public function __construct($params = []) { parent::__construct(); foreach ($params as $paramName => $paramValue) { $this->bindParam($paramName, $paramValue); } $commands = ['ArchStartCommand' => 'Kraken\\Console\\Client\\Command\\Arch\\ArchStartCommand', 'ArchStopCommand' => 'Kraken\\Console\\Client\\Command\\Arch\\ArchStopCommand', 'ArchStatusCommand' => 'Kraken\\Console\\Client\\Command\\Arch\\ArchStatusCommand', 'ProjectCreateCommand' => 'Kraken\\Console\\Client\\Command\\Project\\ProjectCreateCommand', 'ProjectDestroyCommand' => 'Kraken\\Console\\Client\\Command\\Project\\ProjectDestroyCommand', 'ProjectStartCommand' => 'Kraken\\Console\\Client\\Command\\Project\\ProjectStartCommand', 'ProjectStopCommand' => 'Kraken\\Console\\Client\\Command\\Project\\ProjectStopCommand', 'ProjectStatusCommand' => 'Kraken\\Console\\Client\\Command\\Project\\ProjectStatusCommand', 'ProcessExistsCommand' => 'Kraken\\Console\\Client\\Command\\Process\\ProcessExistsCommand', 'ProcessCreateCommand' => 'Kraken\\Console\\Client\\Command\\Process\\ProcessCreateCommand', 'ProcessDestroyCommand' => 'Kraken\\Console\\Client\\Command\\Process\\ProcessDestroyCommand', 'ProcessStartCommand' => 'Kraken\\Console\\Client\\Command\\Process\\ProcessStartCommand', 'ProcessStopCommand' => 'Kraken\\Console\\Client\\Command\\Process\\ProcessStopCommand', 'ThreadExistsCommand' => 'Kraken\\Console\\Client\\Command\\Thread\\ThreadExistsCommand', 'ThreadCreateCommand' => 'Kraken\\Console\\Client\\Command\\Thread\\ThreadCreateCommand', 'ThreadDestroyCommand' => 'Kraken\\Console\\Client\\Command\\Thread\\ThreadDestroyCommand', 'ThreadStartCommand' => 'Kraken\\Console\\Client\\Command\\Thread\\ThreadStartCommand', 'ThreadStopCommand' => 'Kraken\\Console\\Client\\Command\\Thread\\ThreadStopCommand', 'RuntimeExistsCommand' => 'Kraken\\Console\\Client\\Command\\Runtime\\RuntimeExistsCommand', 'RuntimeDestroyCommand' => 'Kraken\\Console\\Client\\Command\\Runtime\\RuntimeDestroyCommand', 'RuntimeStartCommand' => 'Kraken\\Console\\Client\\Command\\Runtime\\RuntimeStartCommand', 'RuntimeStopCommand' => 'Kraken\\Console\\Client\\Command\\Runtime\\RuntimeStopCommand', 'ContainerDestroyCommand' => 'Kraken\\Console\\Client\\Command\\Container\\ContainerDestroyCommand', 'ContainerStartCommand' => 'Kraken\\Console\\Client\\Command\\Container\\ContainerStartCommand', 'ContainerStopCommand' => 'Kraken\\Console\\Client\\Command\\Container\\ContainerStopCommand', 'ContainerStatusCommand' => 'Kraken\\Console\\Client\\Command\\Container\\ContainerStatusCommand', 'ServerPingCommand' => 'Kraken\\Console\\Client\\Command\\Server\\ServerPingCommand']; foreach ($commands as $alias => $class) { $this->registerCommand($alias, $class); } }
/** * @param ValidatorInterface|null $validator */ public function __construct(ValidatorInterface $validator = null) { parent::__construct(); $factory = $this; $factory->bindParam('validator', $validator); $factory->define('HyBi10', function () use($factory) { return new HyBi10\Version($factory->getParam('validator')); })->define('RFC6455', function () use($factory) { return new RFC6455\Version($factory->getParam('validator')); }); }
/** * @param string $name * @param LoopInterface $loop */ public function __construct($name, LoopInterface $loop) { parent::__construct(); $factory = $this; $factory->bindParam('name', $name)->bindParam('loop', $loop); $factory->define(NullModel::class, function ($config = []) { return new NullModel(); })->define(Socket::class, function ($config = []) use($factory) { return new Socket(isset($config['loop']) ? $config['loop'] : $factory->getParam('loop'), array_merge(['id' => isset($config['name']) ? $config['name'] : $factory->getParam('name'), 'endpoint' => '', 'type' => Channel::BINDER, 'host' => isset($config['name']) ? $config['name'] : $factory->getParam('name')], $config)); })->define(ZmqDealer::class, function ($config = []) use($factory) { return new ZmqDealer(isset($config['loop']) ? $config['loop'] : $factory->getParam('loop'), array_merge(['id' => isset($config['name']) ? $config['name'] : $factory->getParam('name'), 'endpoint' => '', 'type' => Channel::BINDER, 'host ' => isset($config['name']) ? $config['name'] : $factory->getParam('name')], $config)); }); }
/** * @param string $name * @param ChannelModelFactoryInterface $modelFactory * @param LoopInterface|null $loop */ 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')); }); }
/** * */ public function __construct() { parent::__construct(); $factory = $this; $factory->define(ThreadManagerBase::class, function ($config = []) { $reflection = new ReflectionClass(ThreadManagerBase::class); return $reflection->newInstanceArgs([$config['runtime'], $config['channel'], $config['context']]); })->define(ThreadManagerRemote::class, function ($config = []) { $reflection = new ReflectionClass(ThreadManagerRemote::class); return $reflection->newInstanceArgs([$config['runtime'], $config['channel'], $config['receiver']]); })->define(ThreadManagerNull::class, function ($config = []) { return new ThreadManagerNull(); }); }