You are here

private function Instantiator::buildAndCacheFromFactory in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php \Doctrine\Instantiator\Instantiator::buildAndCacheFromFactory()

Builds the requested object and caches it in static properties for performance

Parameters

string $className:

Return value

object

1 call to Instantiator::buildAndCacheFromFactory()
Instantiator::instantiate in vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php

File

vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php, line 78

Class

Instantiator
@author Marco Pivetta <ocramius@gmail.com>

Namespace

Doctrine\Instantiator

Code

private function buildAndCacheFromFactory($className) {
  $factory = self::$cachedInstantiators[$className] = $this
    ->buildFactory($className);
  $instance = $factory();
  if ($this
    ->isSafeToClone(new ReflectionClass($instance))) {
    self::$cachedCloneables[$className] = clone $instance;
  }
  return $instance;
}