protected function resolveThemeFile($type, $file, $scope, $asFileInfo = false)
    {
        $themePath = ($scope)? $scope . '/' . ltrim($file, '/') : ltrim($file, '/');
        $path = false;
        $stack = $this->getFallbackThemes();

        array_unshift($stack, $this->getCurrentTheme());

        while (($path === false) && ($theme = array_shift($stack))) {
            $path = $this->findThemeFile($type, $theme, $themePath);
        }

        if (!$asFileInfo && ($path !== false)) {
            $path = $path->getPathname();
        }

        return $path;
    }