You are here

public function RuntimeReflectionService::getAccessibleProperty in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService::getAccessibleProperty()

Returns an accessible property (setAccessible(true)) or null.

Parameters

string $class:

string $property:

Return value

\ReflectionProperty|null

Overrides ReflectionService::getAccessibleProperty

File

vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php, line 78

Class

RuntimeReflectionService
PHP Runtime Reflection Service.

Namespace

Doctrine\Common\Persistence\Mapping

Code

public function getAccessibleProperty($class, $property) {
  $reflectionProperty = new ReflectionProperty($class, $property);
  if ($reflectionProperty
    ->isPublic()) {
    $reflectionProperty = new RuntimePublicReflectionProperty($class, $property);
  }
  $reflectionProperty
    ->setAccessible(true);
  return $reflectionProperty;
}