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;
    }
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;
    }
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 ; }
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
Get the instance either from the pool or create it