/** * Строит сервис. * * @param bool $global * * @return void */ protected function buildService($global = false) { $component = '\\ABC\\Abc\\Components\\' . $this->service . '\\' . $this->service; $typeService = $global ? 'setGlobal' : 'set'; $config = $this->config; $router = Abc::getFromStorage('Router'); $this->locator->{$typeService}($this->service, function () use($component, $config, $router) { $obj = new $component(); $obj->config = $config; $obj->router = $router; return $obj; }); }