You are here

public function RuntimePublicReflectionProperty::getValue in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/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

vendor/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\Reflection

Code

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;
}