Scriptlog Docs

Scriptlog Documentation

Code reference for the Scriptlog codebase

User Tools

Site Tools


scriptlog:lib:core:themeresolutionexception

This is an old revision of the document!


ThemeResolutionException

Layer: Core · Source: lib/core/ThemeResolutionException.php:25 (lines 25–78)


class ThemeResolutionException extends \RuntimeException

Exception thrown when a theme or template cannot be resolved.

This is a framework-level exception that signals a theme configuration or filesystem problem. Callers at the controller / dispatcher layer should catch it and fall back gracefully (e.g. to the default theme) rather than letting the request fail hard.

Factory methods are provided for the most common resolution failures:

\

  throw ThemeResolutionException::notFound('custom-theme');
  throw ThemeResolutionException::missingTemplate('header.php');
\

Inheritance

^ Relation ^ Type ^ Meaning ^
| extends | ''\RuntimeException'' | parent class/interface |

Constants (0)

None.

Properties (0)

None declared.

Methods (3)

^ Visibility ^ Method ^ Summary ^ Line ^
| public static | ''notFound()'' | Create an exception for a theme that could not be resolved. | 36 |
| public static | ''missingTemplate()'' | Create an exception for a required template file that does not exist. | 54 |
| public static | ''invalidTemplateName()'' | Create an exception for an invalid or malicious template name. | 71 |

notFound()

public static function notFound(string $themeName, ?string $fallback = null): self

lines 36–43 (8)

Create an exception for a theme that could not be resolved.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$themeName'' | ''string'' | //required// | The unresolvable theme directory name. |
| ''$fallback'' | ''?string'' | ''null'' | The fallback theme that will be used instead. |

Returns: self — self

missingTemplate()

public static function missingTemplate(string $template, string $themeDir = ''): self

lines 54–61 (8)

Create an exception for a required template file that does not exist.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$template'' | ''string'' | //required// | Template filename (e.g. "header.php"). |
| ''$themeDir'' | ''string'' | '''''' | The theme directory that was searched. |

Returns: self — self

invalidTemplateName()

public static function invalidTemplateName(string $template): self

lines 71–77 (7)

Create an exception for an invalid or malicious template name.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$template'' | ''string'' | //required// | The rejected template name. |

Returns: self — self


This page is generated from source by 'tools/gendoc'. Edits will be overwritten.

scriptlog/lib/core/themeresolutionexception.1790413762.txt.gz · Last modified: by admin