コード例 #1
0
ファイル: ConsoleBoot.php プロジェクト: khelle/surume
 /**
  * @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;
 }
コード例 #2
0
ファイル: ProcessBoot.php プロジェクト: khelle/surume
 /**
  * @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;
 }
コード例 #3
0
ファイル: ConfigProvider.php プロジェクト: khelle/surume
 /**
  * @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);
 }
コード例 #4
0
ファイル: RuleMatchName.php プロジェクト: khelle/surume
 /**
  * @param string $name
  * @param ChannelProtocolInterface $protocol
  * @return bool
  */
 public function __invoke($name, ChannelProtocolInterface $protocol)
 {
     return StringSupport::match($this->name, $name);
 }
コード例 #5
0
ファイル: LogProvider.php プロジェクト: khelle/surume
 /**
  * @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')]);
 }
コード例 #6
0
ファイル: RuleMatchException.php プロジェクト: khelle/surume
 /**
  * @param string $exception
  * @param ChannelProtocolInterface $protocol
  * @return bool
  */
 public function __invoke($exception, ChannelProtocolInterface $protocol)
 {
     return StringSupport::match($this->exception, $protocol->getException());
 }