/** * Resolve service aware components * Each component will be reset before every request is handled */ protected function prepareServiceAwareComponents() { /* @var Di\Service $service */ foreach (static::$di->getServices() as $name => $service) { if (!$service->isShared()) { continue; } $component = static::$di->getShared($name); if ($component instanceof ServiceAwareInterface) { $this->serviceAwareComponents[$name] = $component; } } // Listen for further components Events::attach('di:afterServiceResolve', Closure::bind(function (Event $event) { $data = $event->getData(); $name = $data['name']; $component = $data['instance']; if ($component instanceof ServiceAwareInterface) { $this->serviceAwareComponents[$name] = $component; } }, $this)); }
public function getServices() { return parent::getServices(); }