protected function createInstance(/*# string */ $rawId, array $args)
    {
        // conver 'service_id' to '#service_id'
        $serviceId = ObjectResolver::getServiceId($rawId);

        if (isset($this->loop[$serviceId])) {
            throw new LogicException(
                Message::get(Message::DI_LOOP_DETECTED, $rawId),
                Message::DI_LOOP_DETECTED
            );
        } else {
            $this->loop[$serviceId] = ++$this->counter;
            $obj = $this->getFactory()->createInstance($rawId, $args);
            unset($this->loop[$serviceId]);
            return $obj;
        }
    }
protected function createInstance(/*# string */ $rawId, array $args)
    {
        // conver 'service_id' to '#service_id'
        $serviceId = ObjectResolver::getServiceId($rawId);

        if (isset($this->loop[$serviceId])) {
            throw new LogicException(
                Message::get(Message::DI_LOOP_DETECTED, $rawId),
                Message::DI_LOOP_DETECTED
            );
        } else {
            $this->loop[$serviceId] = ++$this->counter;
            $obj = $this->getFactory()->createInstance($rawId, $args);
            unset($this->loop[$serviceId]);
            return $obj;
        }
    }
protected function createInstance ( /*# string */ $ rawId , array $ args ) { // conver 'service_id' to '#service_id' $ serviceId = ObjectResolver :: getServiceId ( $ rawId ) ; if ( isset ( $ this -> loop [ $ serviceId ] ) ) { throw new LogicException ( Message :: get ( Message :: DI_LOOP_DETECTED , $ rawId ) , Message :: DI_LOOP_DETECTED ) ; } else { $ this -> loop [ $ serviceId ] = ++ $ this -> counter ; $ obj = $ this -> getFactory ( ) -> createInstance ( $ rawId , $ args ) ; unset ( $ this -> loop [ $ serviceId ] ) ; return $ obj ; } }
Create the instance with loop detection

Loop: an instance depends on itself in the creation chain.

@param  string $rawId
@param  array $args arguments for the constructor if any
@return object
@throws LogicException if instantiation goes wrong or loop detected
@access protected
Create the instance with loop detection