Used by the theme_paths and site_theme_paths files in config/ to hard coded certain paths to various themes.

@param $path string
@param $theme object, if null site theme is default
976601
public function setThemeByRoute($path, $theme = null, $wrapper = FILENAME_THEMES_VIEW)
    {
        $this->themePaths[$path] = array($theme, $wrapper);
    }
198288
public function symlink($theme)
    {
        $trace = debug_backtrace();

        if (! isset($trace[1])) return;

        $link = str_replace($this->getThemeName(), $theme, array_get($trace[1], 'file'));

        extract($this->arguments);
        extract($this->view->getShared());

        return require($link);
    }
623626
public function theme_should_be_activated( $theme )
	{
		$theme = $this->replace_variables( $theme );
		$current_theme = $this->get_current_theme();

		if ( $theme !== $current_theme ) {
			throw new \Exception( sprintf(
				"The current theme is %s, but it should be %s",
				$current_theme,
				$theme
			) );
		}
	}
270150
public function getUrl($path)
    {
        if (isset($this->bundleDir)) {
            $path = '/' . $this->bundleDir . '/' . self::THEMES_FOLDER . '/' . ltrim($path, '/');
        }

        return parent::getUrl($path);
    }
316492
public static void setDefaultTheme(int theme) {
        ThemeManager._DEFAULT_THEME = theme;
        if (theme < _START_RESOURCES_ID) {
            ThemeManager._DEFAULT_THEME &= ThemeManager._THEME_MASK;
        }
    }
206890
public function setTheme($theme)
    {
        if (!is_null($this->theme)) {
            $this->resolved && $this->resetViewPaths();

            $this->dispatcher->fire("antares.theme.unset: {$this->theme}");
            $this->dispatcher->fire(new ThemeUnset($this->theme));
        }


        $this->theme = $theme;
        $this->dispatcher->fire("antares.theme.set: {$this->theme}");
        $this->dispatcher->fire(new ThemeSet($this->theme));

        if ($this->resolved) {
            $this->resolved = false;
            $this->resolving();
        }
    }
1067228
private function createSharedThemePath($module, $theme, $base)
    {
        if (is_null($theme)) {
            $theme = $this->theme;
        }

        if (is_null($module)) {
            $module = $this->module;
        }

        return sprintf('%s/%s/%s/%s', $base, $module, self::TEMPLATE_PARAM_BASE_DIR, $theme);
    }
844731
protected function getBasePath(Theme $theme = null) : string
    {
        $theme = $theme ?? $this->getTheme();

        if (isset($this->fullPaths[$theme->getKey()])) {
            return $this->fullPaths[$theme->getKey()];
        }

        return $this->fullPaths[$theme->getKey()] = $this->createPath($theme->getPath(), $this->directory);
    }
71512
public function use($theme, $frontend = true)
    {
        $key      = $frontend ? 'frontend' : 'backend';
        $theme    = $theme ?: config('themes.' . $key, 'default');
        $basePath = config('themes.path.' . $key, base_path('themes/' . $key));
        $this->removeBasePath();
        $this->setBasePath($basePath . DIRECTORY_SEPARATOR . $theme);

        config(['themes.' . $key => $theme]);
    }
1191949
public function defaultIncludePaths( $type, $theme = null ) {

		if ( null === $theme ) {
			$theme = wp_get_theme();
		}

		return [
			$this->pathToUserGeneratedSass(),
			$this->pathToGlobals(),
			$this->pathToFonts(),
			Container::get( 'Styles' )->getDir( $theme ) . "/assets/styles/$type/",
		];
	}
440598
public function setTheme($theme, $themeFolder = ThemesManager::THEMES_FOLDER) {
		$path = \ROOT . \DS . 'views' . \DS . $themeFolder . \DS . $theme;
		if ($theme == '') {
			$path = \ROOT . \DS . 'views';
		}
		if (file_exists ( $path )) {
			$this->loader->setPaths ( [ $path ], "activeTheme" );
		} else {
			throw new ThemesException ( sprintf ( 'The path `%s` does not exists!', $path ) );
		}
	}
210933
private function validateTheme(string $theme)
    {
        if (!file_exists($this->themePath . '/' . $theme . '/info.json')) {
            throw new InvalidException('The theme (`' . $theme . '`) is missing the configuration file (`info.json`).');
        }

        try {
            $themeInfo = $this->getThemeInfo($theme);
        } catch (\Throwable $e) {
            throw new InvalidException('The theme\'s (`' . $theme . '`) configuration file (`info.json`) does not contain valid json or could not be read.');
        }

        foreach (self::CONFIG_REQUIRED_FIELDS as $requiredField) {
            if (!array_key_exists($requiredField, $themeInfo)) {
                throw new InvalidException('The theme\'s (`' . $theme . '`) configuration file (`info.json`) is missing the required theme ' . $requiredField . ' property.');
            }
        }
    }
410472
public function setTheme(string $theme)
    {
        if (!$this->isPathValid($theme)) {
            throw new NotFoundException('The theme cannot be found.');
        }

        $this->validateTheme($theme);

        $themeInfo = $this->getThemeInfo($theme);

        if (array_key_exists('parent', $themeInfo)) {
            $this->childTheme = $themeInfo;

            $this->setTheme($themeInfo['parent']);
        } else {
            $this->theme = $themeInfo;
        }
    }
77025
public function load(string $path): ThemeManager
    {
        $this->setThemeDirectory();
        $this->setThemeConstants();
        $this->loadThemeConfiguration($path);
        $this->setThemeAutoloading();

        return $this;
    }
408080
public function theme($theme = null)
    {
        if ($theme === null) {
            return isset($this->_data['theme']) ? $this->_data['theme'] : '';
        }
        $this->_data['theme'] = $theme;
    }
638155
public function HashFile($path, $theme = true)
    {
        $path = $theme ? $this->getPath($path) : $path;

        if (file_exists($path)) {
            $hash = md5_file($path);
            return str_replace(array('/', '+', '='), '', base64_encode(pack('H*', $hash)));
        }

        return '';
    }
1338824
public function addTheme(Theme $theme)
    {
        $themeName = $this->normalizeKey($theme->getThemeName());

        $this->themes[$themeName] = $theme;
    }