You are here

public function Instantiator::instantiate 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::instantiate()

Parameters

string $className:

Return value

object

Throws

\Doctrine\Instantiator\Exception\ExceptionInterface

Overrides InstantiatorInterface::instantiate

File

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

Class

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

Namespace

Doctrine\Instantiator

Code

public function instantiate($className) {
  if (isset(self::$cachedCloneables[$className])) {
    return clone self::$cachedCloneables[$className];
  }
  if (isset(self::$cachedInstantiators[$className])) {
    $factory = self::$cachedInstantiators[$className];
    return $factory();
  }
  return $this
    ->buildAndCacheFromFactory($className);
}