original_string: protected function getInstance(/*# string */ $id, array $args)
      {
          // get id & scope info
          list($rawId, $scopedId, $scope) = $this->realScopeInfo($id);
  
          // get from the pool
          if (isset($this->pool[$scopedId])) {
              return $this->pool[$scopedId];
          }
  
          // create instance
          $instance = $this->createInstance($rawId, $args);
  
          // save in the pool
          if (empty($args) && ScopeInterface::SCOPE_SINGLE !== $scope) {
              $this->pool[$scopedId] = $instance;
          }
  
          return $instance;
      }
code: protected function getInstance(/*# string */ $id, array $args)
      {
          // get id & scope info
          list($rawId, $scopedId, $scope) = $this->realScopeInfo($id);
  
          // get from the pool
          if (isset($this->pool[$scopedId])) {
              return $this->pool[$scopedId];
          }
  
          // create instance
          $instance = $this->createInstance($rawId, $args);
  
          // save in the pool
          if (empty($args) && ScopeInterface::SCOPE_SINGLE !== $scope) {
              $this->pool[$scopedId] = $instance;
          }
  
          return $instance;
      }
code_tokens: protected function getInstance ( /*# string */ $ id , array $ args ) { // get id & scope info list ( $ rawId , $ scopedId , $ scope ) = $ this -> realScopeInfo ( $ id ) ; // get from the pool if ( isset ( $ this -> pool [ $ scopedId ] ) ) { return $ this -> pool [ $ scopedId ] ; } // create instance $ instance = $ this -> createInstance ( $ rawId , $ args ) ; // save in the pool if ( empty ( $ args ) && ScopeInterface :: SCOPE_SINGLE !== $ scope ) { $ this -> pool [ $ scopedId ] = $ instance ; } return $ instance ; }
docstring: Get the instance either from the pool or create it
  
  @param  string $id service id with or without the scope
  @param  array $args arguments for the constructor
  @return object
  @throws LogicException if instantiation goes wrong
  @throws RuntimeException if method execution goes wrong
  @access protected
docstring_tokens: Get the instance either from the pool or create it