/** * @param CoreInterface $core * @param CoreInputContextInterface $context * @return string[] */ private function getDefaultVariables(CoreInterface $core, CoreInputContextInterface $context) { return ['runtime' => $context->type(), 'parent' => $context->parent(), 'alias' => $context->alias(), 'name' => $context->name(), 'basepath' => $core->basePath(), 'datapath' => $core->dataPath(), 'host.main' => '127.0.0.1']; }
/** * @param callable $handler */ public function registerShutdownHandler(callable $handler) { register_shutdown_function(function () use($handler) { return $handler($this->context->type() === Runtime::UNIT_PROCESS); }); }