protected function evaluateResourcePath($requestedPath, $checkForExistence = true)
    {
        $requestPathParts = explode('://', $requestedPath, 2);
        if ($requestPathParts[0] !== self::SCHEME) {
            throw new \InvalidArgumentException('The ' . __CLASS__ . ' only supports the \'' . self::SCHEME . '\' scheme.', 1256052544);
        }

        if (!isset($requestPathParts[1])) {
            return false;
        }

        $resourceUriWithoutScheme = $requestPathParts[1];

        if (strpos($resourceUriWithoutScheme, '/') === false && preg_match('/^[0-9a-f]{40}$/i', $resourceUriWithoutScheme) === 1) {
            $resource = $this->resourceManager->getResourceBySha1($resourceUriWithoutScheme);
            return $this->resourceManager->getStreamByResource($resource);
        }

        list($packageName, $path) = explode('/', $resourceUriWithoutScheme, 2);

        try {
            $package = $this->packageManager->getPackage($packageName);
        } catch (\Neos\Flow\Package\Exception\UnknownPackageException $packageException) {
            throw new ResourceException(sprintf('Invalid resource URI "%s": Package "%s" is not available.', $requestedPath, $packageName), 1309269952, $packageException);
        }

        if (!$package instanceof FlowPackageInterface) {
            return false;
        }

        $resourceUri = Files::concatenatePaths([$package->getResourcesPath(), $path]);

        if ($checkForExistence === false || file_exists($resourceUri)) {
            return $resourceUri;
        }

        return false;
    }
protected function evaluateResourcePath($requestedPath, $checkForExistence = true)
    {
        $requestPathParts = explode('://', $requestedPath, 2);
        if ($requestPathParts[0] !== self::SCHEME) {
            throw new \InvalidArgumentException('The ' . __CLASS__ . ' only supports the \'' . self::SCHEME . '\' scheme.', 1256052544);
        }

        if (!isset($requestPathParts[1])) {
            return false;
        }

        $resourceUriWithoutScheme = $requestPathParts[1];

        if (strpos($resourceUriWithoutScheme, '/') === false && preg_match('/^[0-9a-f]{40}$/i', $resourceUriWithoutScheme) === 1) {
            $resource = $this->resourceManager->getResourceBySha1($resourceUriWithoutScheme);
            return $this->resourceManager->getStreamByResource($resource);
        }

        list($packageName, $path) = explode('/', $resourceUriWithoutScheme, 2);

        try {
            $package = $this->packageManager->getPackage($packageName);
        } catch (\Neos\Flow\Package\Exception\UnknownPackageException $packageException) {
            throw new ResourceException(sprintf('Invalid resource URI "%s": Package "%s" is not available.', $requestedPath, $packageName), 1309269952, $packageException);
        }

        if (!$package instanceof FlowPackageInterface) {
            return false;
        }

        $resourceUri = Files::concatenatePaths([$package->getResourcesPath(), $path]);

        if ($checkForExistence === false || file_exists($resourceUri)) {
            return $resourceUri;
        }

        return false;
    }
protected function evaluateResourcePath ( $ requestedPath , $ checkForExistence = true ) { $ requestPathParts = explode ( '://' , $ requestedPath , 2 ) ; if ( $ requestPathParts [ 0 ] !== self :: SCHEME ) { throw new \ InvalidArgumentException ( 'The ' . __CLASS__ . ' only supports the \'' . self :: SCHEME . '\' scheme.' , 1256052544 ) ; } if ( ! isset ( $ requestPathParts [ 1 ] ) ) { return false ; } $ resourceUriWithoutScheme = $ requestPathParts [ 1 ] ; if ( strpos ( $ resourceUriWithoutScheme , '/' ) === false && preg_match ( '/^[0-9a-f]{40}$/i' , $ resourceUriWithoutScheme ) === 1 ) { $ resource = $ this -> resourceManager -> getResourceBySha1 ( $ resourceUriWithoutScheme ) ; return $ this -> resourceManager -> getStreamByResource ( $ resource ) ; } list ( $ packageName , $ path ) = explode ( '/' , $ resourceUriWithoutScheme , 2 ) ; try { $ package = $ this -> packageManager -> getPackage ( $ packageName ) ; } catch ( \ Neos \ Flow \ Package \ Exception \ UnknownPackageException $ packageException ) { throw new ResourceException ( sprintf ( 'Invalid resource URI "%s": Package "%s" is not available.' , $ requestedPath , $ packageName ) , 1309269952 , $ packageException ) ; } if ( ! $ package instanceof FlowPackageInterface ) { return false ; } $ resourceUri = Files :: concatenatePaths ( [ $ package -> getResourcesPath ( ) , $ path ] ) ; if ( $ checkForExistence === false || file_exists ( $ resourceUri ) ) { return $ resourceUri ; } return false ; }
Evaluates the absolute path and filename of the resource file specified
by the given path.

@param string $requestedPath
@param boolean $checkForExistence Whether a (non-hash) path should be checked for existence before being returned
@return mixed The full path and filename or false if the file doesn't exist
@throws \InvalidArgumentException|ResourceException
Evaluates the absolute path and filename of the resource file specified by the given path .