Returns the unique identifier.

@param Theme $theme

@return string
352742
protected function getUniqueId(Theme $theme)
    {
        $baseId = $theme->getId();

        $idNumber = 0;
        while ($this->hasTheme($baseId . $idNumber)) {
            $idNumber++;
        }

        return $baseId . $idNumber;
    }
535028
protected function getCacheKey($template)
    {
        $name = $template->getLogicalName();

        if ($this->activeTheme) {
            $name .= '|'.$this->activeTheme->getName();
        }

        return $name;
    }
251971
public function findOrFail($theme, $type = 'frontend')
    {
        if (in_array($type . '.' . $theme, array_keys($this->themes))) {
            return $this->themes[$type . '.' . $theme];
        }

        throw new ThemeNotFoundException('Theme not found!');
    }
294493
public function find($themeName)
    {
        foreach ($this->getDirectories() as $directory) {
            if (! str_contains($directory, $themeName)) {
                continue;
            }

            return $this->getThemeInfoForPath($directory);
        }

        throw new ThemeNotFoundException($themeName);
    }
802924
public function setDefault($theme) : Theme
    {
        if ($theme instanceof Theme) {
            $default = $theme;
        } elseif ($this->has($theme)) {
            $default = $this->get($theme);
        }

        if (!isset($default)) {
            throw new NullValueException("Cannot set default theme when theme does not exist");
        }

        if (!$default->verified()) {
            throw new \InvalidArgumentException("Cannot set default theme to an unverified theme");
        }

        return $this->default = $default;
    }
532183
public function _getTemplateId()
    {
        return isset($this->templateId) ? $this->templateId : $this->templateId =
            $this->smarty->_getTemplateId($this->template_resource, $this->cache_id, $this->compile_id);
    }
1147801
protected function get_filepicker_unique_id() : string {
        if (empty($this->filepickeruniqueid)) {
            $this->filepickeruniqueid = uniqid();
        }
        return $this->filepickeruniqueid;
    }
224651
public function get_identifier() {
        static $instances = 0;
        if ($this->lockidentifier === null) {
            $this->lockidentifier = md5(
                $this->get_definition()->generate_definition_hash() .
                sesskey() .
                $instances++ .
                'cache_application'
            );
        }
        return $this->lockidentifier;
    }
827245
public function render($template = 'Index'): string
    {
        $class = '\Themes\\' . $this->theme . '\\' . $template . 'Template';

        $template = new $class($this);

        ob_start();

        $template->render();

        $result = ob_get_clean();

        return $result;
    }
1006075
protected function missing(string $resource, Theme $theme = null)
    {
        $path = $this->getBasePath();

        $message = "{$resource} not found in {$path}";

        if (!$this->themeIsDefault($theme)) {
            $default = $this->getBasePath($this->getDefaultTheme());

            $message .= " or {$default}";
        }

        $this->logger->warning($message);
    }
997904
public function getUniqueIdentifiers()
    {
        if (!isset($this->_unique_identifiers)) {
            $classname = $this->getEntityIdentifier()->classname;
            $this->_unique_identifiers = get_parents($classname, 'AnDomainEntity');
            if (strpos($classname, 'AnDomainEntity') !== 0) {
                $this->_unique_identifiers[] = $classname;
            }
            $this->_unique_identifiers[] = (string) $this->getEntityIdentifier();
        }

        return $this->_unique_identifiers;
    }
110007
public function getResourcePath(string $resource, Theme $theme = null) : string
    {
        return $this->createPath($this->getBasePath($theme), $resource);
    }
923949
protected function findIdentity($template)
    {
        if (!isset($this->identities[(string)$template])) {
            $this->identities[(string)$template] = $this->getIdentity()->identify($template);
        }

        return $this->identities[(string)$template];
    }
884166
public static function initFallback($theme)
    {
        $obj = self::inTheme($theme);
        $obj->markup = '{% page %}';
        $obj->fileName = self::FALLBACK_FILE_NAME;
        return $obj;
    }
1246402
public function setOverride($theme = null) : ?Theme
    {
        if ($theme === null) {
            return $this->override = null;
        }

        if ($theme instanceof Theme) {
            $this->override = $theme;
        } elseif ($this->has($theme)) {
            $this->override = $this->get($theme);
        }

        if ($this->override === null || ($this->override !== null && !$this->override->verified())) {
            $this->override = $this->default;
        }

        return $this->override;
    }
24437
public function canEdit(Theme $theme, User $user)
    {
        return !(
            !empty($theme->getPlugin()) // plugin themes
            || (empty($theme->getUser()) && !$this->authorization->isGranted('ROLE_ADMIN')) // custom platform themes
            || (!empty($theme->getUser() && $user !== $theme->getUser())) // users themes
        );
    }
280607
protected function getThemeIdFromThemeDetailsProviders()
    {
        $providers = $this->getThemeDetailsProviders();
        foreach ($providers as $provider) {
            if ($provider instanceof ThemeDetailsProviderInterface) {
                $themeId = $provider->getThemeId();
                if (!empty($themeId) && $themeId !== ' ') {
                    if ($this->hasTheme($themeId)) {
                        return $themeId;
                    }

                    \common_Logger::i(
                        'The requested theme ' . $themeId .
                        ' requested by the ' . get_class($provider) . ' provider does not exist!'
                    );
                }
            }
        }

        return '';
    }