コード例 #1
0
 /**
  * @param string $className
  * @param array $constructorArguments
  * @return object
  */
 public function getInstanceOfClass($className, array $constructorArguments = array())
 {
     $fullFactoryClassName = $this->getFullFactoryClassName($className);
     $factoryClassName = $this->getFactoryClassName($className);
     if ($this->factoryClassExists($fullFactoryClassName, $factoryClassName)) {
         return $fullFactoryClassName::getInstance($constructorArguments);
     }
     return parent::getInstanceOfClass($className, $constructorArguments);
 }
コード例 #2
0
 public function testInjectionLoopDetectionNoRecA()
 {
     $config = new Configuration();
     $dic = new DependencyInjectionContainer($config);
     $this->assertInstanceOf(InjectionLoopDetectionTest_NoRecA::class, $dic->getInstanceOfClass(InjectionLoopDetectionTest_NoRecA::class));
 }
コード例 #3
0
 public function testGetInstanceOfClassWhereDefaultImplementedByIsNotTheFirstItem()
 {
     $dic = new DependencyInjectionContainer();
     $class = $dic->getInstanceOfClass('issueImplementedByOrder\\name\\B');
     $this->assertInstanceOf('issueImplementedByOrder\\name\\D', $class);
 }