protected function doInjection($instance, $className) { $propertiesAnnotations = $this->annotationManager->getPropertiesAnnotations($className); foreach ($propertiesAnnotations as $propertyName => $annotations) { if (isset($annotations['Inject'])) { /** @var \A7\Annotations\Inject $inject */ $inject = $annotations['Inject']; $reflectionProperty = new \ReflectionProperty($instance, $propertyName); $reflectionProperty->setAccessible(true); if (isset($annotations['var'])) { $inject->setVar($annotations['var']); } $inject->isInjectObject(); if ($inject->isInjectObject()) { $reflectionProperty->setValue($instance, $this->a7->get($inject->getName())); } else { $name = $inject->getName(); if (isset($name) && isset($this->parameters[$name])) { $reflectionProperty->setValue($instance, $this->parameters[$name]); } } } } return $instance; }
protected function isLazy($class) { $injectable = $this->annotationManager->getClassAnnotation($class, 'Injectable'); /** @var Injectable $injectable */ $injectable = !isset($injectable) ? new Injectable() : $injectable; return $injectable->lazy; }