This is an old revision of the document!
Table of Contents
AbstractThemeViewModel
Layer: Core · Source: lib/core/Theme/AbstractThemeViewModel.php:19 (lines 19–69)
abstract class AbstractThemeViewModel implements ThemeViewModelInterface
Base implementation shared by all theme view models.
Provides a single `fromRow()` contract and the escaped-value storage. All values are escaped once, at construction time, through a callable passed in by the factory. Subclasses only declare their public getters.
Docblock Metadata
^ Tag ^ Value ^ | ''@category'' | Theme | | ''@author'' | M.Noermoehammad | | ''@license'' | MIT | | ''@version'' | 1.0 |
Inheritance
^ Relation ^ Type ^ Meaning ^ | implements | [[scriptlog:lib:core:themeviewmodelinterface|''ThemeViewModelInterface'']] | contract |
Constants (0)
None.
Properties (1)
^ Visibility ^ Type ^ Name ^ Default ^ Line ^ | ''protected'' | ''(untyped)'' | ''$values'' | ''[];'' | 22 |
Methods (4)
^ Visibility ^ Method ^ Summary ^ Line ^ | public static | ''fromRow()'' | Build the view model from a prepared row, escaping each value once. | 31 | | public | ''get()'' | Return the escaped value for a given key. | 42 | | public | ''toArray()'' | Return all escaped display values keyed by their public name. | 50 | | protected static | ''safe()'' | Escape a single raw value through the provided boundary. | 62 |
fromRow()
public static function fromRow(array $row, callable $escape)
line 31
Build the view model from a prepared row, escaping each value once.
^ Parameter ^ Type ^ Default ^ Description ^ | ''$row'' | ''array'' | //required// | //none// | | ''$escape'' | ''callable'' | //required// | //none// |
Returns: (none declared) — static
get()
public function get(string $key): ?string
lines 42–45 (4)
Return the escaped value for a given key.
^ Parameter ^ Type ^ Default ^ Description ^ | ''$key'' | ''string'' | //required// | //none// |
Returns: ?string — string|null
toArray()
public function toArray(): array
lines 50–53 (4)
Documentation inherited from ''Scriptlog\Core\Theme\ThemeViewModelInterface''.
Return all escaped display values keyed by their public name.
Takes no parameters.
Returns: array — array<string, string|null>
safe()
protected static function safe($raw, callable $escape): ?string
lines 62–68 (7)
Escape a single raw value through the provided boundary.
^ Parameter ^ Type ^ Default ^ Description ^ | ''$raw'' | ''(untyped)'' | //required// | //none// | | ''$escape'' | ''callable'' | //required// | //none// |
Returns: ?string — string|null
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
