You are here

protected static function Reflection::getReflProperties in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-hydrator/src/Reflection.php \Zend\Hydrator\Reflection::getReflProperties()

Get a reflection properties from in-memory cache and lazy-load if class has not been loaded.

Parameters

string|object $input:

Return value

ReflectionProperty[]

Throws

Exception\InvalidArgumentException

2 calls to Reflection::getReflProperties()
Reflection::extract in vendor/zendframework/zend-hydrator/src/Reflection.php
Extract values from an object
Reflection::hydrate in vendor/zendframework/zend-hydrator/src/Reflection.php
Hydrate $object with the provided $data.

File

vendor/zendframework/zend-hydrator/src/Reflection.php, line 72

Class

Reflection

Namespace

Zend\Hydrator

Code

protected static function getReflProperties($input) {
  if (is_object($input)) {
    $input = get_class($input);
  }
  elseif (!is_string($input)) {
    throw new Exception\InvalidArgumentException('Input must be a string or an object.');
  }
  if (isset(static::$reflProperties[$input])) {
    return static::$reflProperties[$input];
  }
  static::$reflProperties[$input] = [];
  $reflClass = new ReflectionClass($input);
  $reflProperties = $reflClass
    ->getProperties();
  foreach ($reflProperties as $property) {
    $property
      ->setAccessible(true);
    static::$reflProperties[$input][$property
      ->getName()] = $property;
  }
  return static::$reflProperties[$input];
}