src/Vectorface/SnappyRouter/Di/ServiceProvider.php
public function getServiceInstance($key, $useCache = true)
    {
        // retrieve the service from the instance cache if it exists
        if ($useCache && isset($this->instanceCache[$key])) {
            return $this->instanceCache[$key];
        }

        // retrieve the given controller from the key using the proper
        // provisioning mode
        switch ($this->provisioningMode) {
            case self::PROVISIONING_MODE_NAMESPACES:
                $this->instanceCache[$key] = $this->getServiceFromNamespaces($key);
                break;
            case self::PROVISIONING_MODE_FOLDERS:
                $this->instanceCache[$key] = $this->getServiceFromFolder($key);
                break;
            default:
                $this->instanceCache[$key] = $this->getServiceFromServiceList($key);
        }
        return $this->instanceCache[$key];
    }
public function getServiceInstance($key, $useCache = true)
    {
        // retrieve the service from the instance cache if it exists
        if ($useCache && isset($this->instanceCache[$key])) {
            return $this->instanceCache[$key];
        }

        // retrieve the given controller from the key using the proper
        // provisioning mode
        switch ($this->provisioningMode) {
            case self::PROVISIONING_MODE_NAMESPACES:
                $this->instanceCache[$key] = $this->getServiceFromNamespaces($key);
                break;
            case self::PROVISIONING_MODE_FOLDERS:
                $this->instanceCache[$key] = $this->getServiceFromFolder($key);
                break;
            default:
                $this->instanceCache[$key] = $this->getServiceFromServiceList($key);
        }
        return $this->instanceCache[$key];
    }
public function getServiceInstance ( $ key , $ useCache = true ) { // retrieve the service from the instance cache if it exists if ( $ useCache && isset ( $ this -> instanceCache [ $ key ] ) ) { return $ this -> instanceCache [ $ key ] ; } // retrieve the given controller from the key using the proper // provisioning mode switch ( $ this -> provisioningMode ) { case self :: PROVISIONING_MODE_NAMESPACES : $ this -> instanceCache [ $ key ] = $ this -> getServiceFromNamespaces ( $ key ) ; break ; case self :: PROVISIONING_MODE_FOLDERS : $ this -> instanceCache [ $ key ] = $ this -> getServiceFromFolder ( $ key ) ; break ; default : $ this -> instanceCache [ $ key ] = $ this -> getServiceFromServiceList ( $ key ) ; } return $ this -> instanceCache [ $ key ] ; }
Returns an instance of the specified service.
@param string $key The key to lookup.
@param boolean $useCache An optional flag indicating whether we should
use the cache. True by default.
@return AbstractController Returns an instance of the specified service.
@throws ServiceNotFoundForKeyException Throws this exception if the key isn't associated
with any registered service.
Returns an instance of the specified service .