protected function getThemeToUse(ResourceSettings $settings) : Theme
    {
        if ($settings->theme instanceof Theme) {
            return $settings->theme;
        }

        return $settings->themeName !== null ? $this->getTheme($settings->themeName) : $this->getDefaultTheme();
    }