Ouzo\Injection\InstanceFactory::createInstance PHP Метод

createInstance() публичный Метод

public createInstance ( InstanceRepository $repository, $className )
$repository InstanceRepository
    public function createInstance(InstanceRepository $repository, $className)
    {
        $instance = new $className();
        $this->injectDependencies($repository, $instance);
        return $instance;
    }

Usage Example

Пример #1
0
 public function singletonInstance(InstanceFactory $factory, $className)
 {
     if (isset($this->instances[$className])) {
         return $this->instances[$className];
     }
     $instance = $factory->createInstance($this, $className);
     $this->instances[$className] = $instance;
     return $instance;
 }