Ding\Container\Impl\ContainerImpl::getResource PHP Method

getResource() public method

(non-PHPdoc)
public getResource ( $location, $context = false )
    public function getResource($location, $context = false)
    {
        // Missing scheme?
        $scheme = strpos($location, '://');
        if ($scheme === false) {
            $location = FilesystemResource::SCHEME . $location;
        }
        // Already served?
        if (isset($this->_resources[$location])) {
            return $this->_resources[$location];
        }
        // See what kind of resource to return.
        if (strpos($location, FilesystemResource::SCHEME) === 0) {
            $resource = new FilesystemResource($location, $context);
        } else {
            if (strpos($location, IncludePathResource::SCHEME) === 0) {
                $resource = new IncludePathResource($location, $context);
            } else {
                $resource = new URLResource($location, $context);
            }
        }
        $this->_resources[$location] = $resource;
        return $resource;
    }