PageAssets
Everything the components on one page declared, gathered once and ready to embed. `unreadable` is the reason this is a value object and not two strings. A component that names a stylesheet it does not ship is a packaging defect that otherwise shows up as "the thing renders * but looks wrong" — a symptom no page can tell apart from a styling mistake. Naming it here keeps the page rendering (a missing look is not worth a 500) while leaving the defect machine-readable for whoever asks.
PageAssets::__construct()
public function __construct(string $styles = '', array $scripts = [], array $messages = [], array $emitted = [], array $unreadable = [], array $refused = [], array $components = []):Parameters
| Name | Type | Description |
|---|---|---|
| $styles | string | |
| $scripts | array<int, string> | Client scripts, in declaration order. |
| $messages | array<string, string> | Resolved words, keyed `component.key`. |
| $emitted | array<int, string> | `name@version` of every component that contributed. |
| $unreadable | array<string, string> | `name@version` => the path it declared and does not ship. |
| $refused | array<string, string> | `name@version` => why part of an override was not honoured. |
| $components | array<string, array{styles: string, scripts: list<string>, messages: array<string, string>}> | each contract's contribution, kept separate so a live response can add a newly-rendered contract once |
PageAssets::styleTag()
public function styleTag(): stringEvery contributed stylesheet, already scoped, as one tag — or nothing at all when no component on this page declared one, because an empty `<style>` is noise in the source of every page.
PageAssets::scriptTag()
public function scriptTag(): stringEvery contributed script as one tag, in declaration order, or nothing when there is none.
PageAssets::messagesTag()
public function messagesTag(): stringThe page's words as a payload the client can read, or nothing when there are none. JSON in a `type="application/json"` script rather than a JS assignment: the browser will not execute it, so a translation carrying an apostrophe or a `</script>` cannot become code.
PageAssets::isEmpty()
public function isEmpty(): boolWhether this page has nothing to embed — including the case where every component that declared something declared a file it does not ship, which is a defect, not an absence.