private function processInstance($compiler) { if (is_object($compiler)) { return $compiler; } elseif (class_exists($compiler)) { return $this->container->getInstance($compiler); } throw Exception::neitherObjectOrClass($compiler); }
protected function setUp() { $container = new IocContainer(); $this->binder = new BinderStub(); $container->register(Binder::class, $this->binder); $this->cache = new CachedBinderStub(); $container->register(CachedBinder::class, $this->cache); $this->context = new ContextMock(); $this->compiler = new ProcessorListStub(); $handler = new CompilerHandler($this->compiler, $container); $executor = new Executor($container, $this->context); $this->target = new FluentBuilder($executor, $this->context, $handler); }
private function getBinder() { $class = $this->context->hasCache() ? CachedBinder::class : Binder::class; return $this->container->getInstance($class); }
/** * @test * @expectedException InvalidArgumentException */ public function getInstance_failComplexDependencyLoop() { $this->target->getInstance(DummyLoopComplex::class); }