original_string: 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;
          }
      }
code: 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;
          }
      }
code_tokens: 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 ; } }
docstring: 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
docstring_tokens: Create the instance with loop detection