コード例 #1
0
ファイル: ControllerValueResolver.php プロジェクト: brick/app
 /**
  * {@inheritdoc}
  */
 public function getPropertyValue(\ReflectionProperty $property)
 {
     $class = $this->reflectionTools->getPropertyClass($property);
     if ($class == Request::class) {
         return $this->request;
     }
     $name = $property->getName();
     if (isset($this->parameters[$name])) {
         return $this->parameters[$name];
     }
     return $this->fallbackResolver->getPropertyValue($property);
 }
コード例 #2
0
ファイル: ContainerValueResolver.php プロジェクト: brick/di
 /**
  * {@inheritdoc}
  */
 public function getPropertyValue(\ReflectionProperty $property)
 {
     // Check if an injection key is available for this property.
     $key = $this->injectionPolicy->getPropertyKey($property);
     if ($key !== null) {
         return $this->container->get($key);
     }
     // Try to resolve the property by type.
     $className = $this->reflectionTools->getPropertyClass($property);
     if ($className !== null) {
         if ($this->container->has($className)) {
             return $this->container->get($className);
         }
     }
     return $this->defaultValueResolver->getPropertyValue($property);
 }