/** * @param string $path * @return ConsoleClientInterface */ public function boot($path) { $core = (require realpath($path) . '/bootstrap/ConsoleClient/bootstrap.php'); $controller = (new ReflectionClass(StringSupport::parametrize($this->controllerClass, $this->params)))->newInstanceArgs(array_merge($this->controllerParams)); $controller->setCore($core); $core->config($controller->internalConfig($core)); $controller->internalBoot($core); $core->boot(); $controller->internalConstruct($core); return $controller; }
/** * @param string $path * @return RuntimeInterface */ public function boot($path) { $datapath = realpath($path); $controller = (new ReflectionClass(StringSupport::parametrize($this->controllerClass, $this->params)))->newInstanceArgs(array_merge($this->controllerParams)); if (file_exists($datapath . '/bootstrap/' . $controller->name() . '/bootstrap.php')) { $core = (require $datapath . '/bootstrap/' . $controller->name() . '/bootstrap.php'); } else { $core = (require $datapath . '/bootstrap-global/Process/bootstrap.php'); } $controller->setCore($core); $core->config($controller->internalConfig($core)); $controller->internalBoot($core); $core->boot(); $controller->getLoop()->setFlowController($this->runtimeController); $controller->internalConstruct($core); return $controller; }
/** * @param CoreInterface $core */ protected function register(CoreInterface $core) { $context = $core->make('Surume\\Core\\CoreInputContextInterface'); $global = $core->dataPath() . '/config-global/' . $this->getDir($core->unit()); $local = $core->dataPath() . '/config/' . $context->name(); $config = new Config(); $this->addConfigByPath($config, $global); $this->addConfigByPath($config, $local); $this->addConfig($config, new Config($core->config())); $vars = array_merge($config->exists('vars') ? $config->get('vars') : [], $this->getDefaultVariables($core, $context)); $records = ArraySupport::flatten($config->all()); foreach ($records as $key => $value) { $new = StringSupport::parametrize($value, $vars); if (is_string($value) && $new != $value) { $config->set($key, $new); } } $core->instance('Surume\\Config\\ConfigInterface', $config); }
/** * @param string $name * @param ChannelProtocolInterface $protocol * @return bool */ public function __invoke($name, ChannelProtocolInterface $protocol) { return StringSupport::match($this->name, $name); }
/** * @param string $path * @param string $level * @return string */ private function filePath($path, $level) { return StringSupport::parametrize($path, ['level' => $level, 'date' => date('Y-m-d'), 'time' => date('H:i:s')]); }
/** * @param string $exception * @param ChannelProtocolInterface $protocol * @return bool */ public function __invoke($exception, ChannelProtocolInterface $protocol) { return StringSupport::match($this->exception, $protocol->getException()); }