public function RuntimePublicReflectionProperty::getValue in Service Container 7.2
Same name and namespace in other branches
- 7 modules/providers/service_container_annotation_discovery/lib/Doctrine/common/lib/Doctrine/Common/Reflection/RuntimePublicReflectionProperty.php \Doctrine\Common\Reflection\RuntimePublicReflectionProperty::getValue()
Checks is the value actually exist before fetching it. This is to avoid calling `__get` on the provided $object if it is a {
See also
\Doctrine\Common\Proxy\Proxy}.
File
- modules/
providers/ service_container_annotation_discovery/ lib/ Doctrine/ common/ lib/ Doctrine/ Common/ Reflection/ RuntimePublicReflectionProperty.php, line 40
Class
- RuntimePublicReflectionProperty
- PHP Runtime Reflection Public Property - special overrides for public properties.
Namespace
Doctrine\Common\ReflectionCode
public function getValue($object = null) {
$name = $this
->getName();
if ($object instanceof Proxy && !$object
->__isInitialized()) {
$originalInitializer = $object
->__getInitializer();
$object
->__setInitializer(null);
$val = isset($object->{$name}) ? $object->{$name} : null;
$object
->__setInitializer($originalInitializer);
return $val;
}
return isset($object->{$name}) ? parent::getValue($object) : null;
}