classPageShell
final class PageShell
The document every page of the report is written into.
The page is a doc-ui document: the compact layout document-design keeps for catalogs and references, with the navigation beside the reading and the tools along the top. The navigation names the routes to a statement — by table, by namespace, by file, by finding, or through the whole listing — and then whatever the page being read is best left from: the other tables beside a table, the other classes of a namespace beside a class, the places a statement belongs to beside the statement, and the sections of a long page. Each page says what that is; the shell only writes it.
Constants§
public const DESIGN_VERSION = 'v1.0.0'The release of document-design the pages are written for, and never a later one.
public const DESIGN_STYLE = 'assets/document-design-' . self::DESIGN_VERSION . '.css'The name the document-design stylesheet is written under.
public const DESIGN_SCRIPT = 'assets/document-design-' . self::DESIGN_VERSION . '.js'The name the document-design script is written under.
public const DESIGN_LICENSE = 'assets/document-design-LICENSE.txt'The name the document-design license and provenance notice is written under.
public const SCRIPT = 'assets/report.js'The name the report's own script is written under.
public const INDEX = 'assets/search-index.js'The name the search index is written under.
public const THEME_KEY = 'sql-catalog-theme'The key the chosen theme is remembered under.
public const LIMIT = 40How many entries a navigation block lists before pointing at the listing.
Methods§
public function __construct(?HtmlText $text = null)public function render(
ReportSite $site,
string $page,
string $title,
list<array{string, string|null}> $crumbs,
string $body,
list<array{string, list<array{string, string, int|null, bool}>, string|null}> $blocks = [],
): stringOne complete page of the report.
Parameters
$site | ReportSite | |
$page | string | The name the page is written under, which fixes what its links are relative to |
$title | string | |
$crumbs | list<array{string, string|null}> | The trail to this page, as label and address pairs |
$body | string | |
$blocks | list<array{string, list<array{string, string, int|null, bool}>, string|null}> | The navigation the page is best left from: a title, its entries as label, address, count and whether it is the page being read, and where the rest of them are |
Returns
stringTest cases 2
Called from 10
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:78
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:82
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:83
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:85
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:87
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:89
- method-call SqlCatalog\Reporter\Html\HtmlReporter::tablePages() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:109
- method-call SqlCatalog\Reporter\Html\HtmlReporter::classPages() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:133
- method-call SqlCatalog\Reporter\Html\HtmlReporter::filePages() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:157
- method-call SqlCatalog\Reporter\Html\HtmlReporter::statementPages() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:181
Calls 8
- method-call ReportSite::prefixOf() line 82
- method-call PageShell::head() line 84
- method-call HtmlText::escape() line 85
- method-call PageShell::sidebar() line 88
- method-call PageShell::topbar() line 90
- class-const PageShell::INDEX() line 96
- class-const PageShell::SCRIPT() line 97
- class-const PageShell::DESIGN_SCRIPT() line 98
public function head(string $prefix, string $title): stringThe head of a page: its title, the doc-ui stylesheet, and the theme restored before the first paint.
Parameters
$prefix | string | |
$title | string |
Returns
stringTest cases 1
Called from 1
Calls 4
- class-const PageShell::THEME_KEY() line 109
- method-call HtmlText::escape() line 114
- class-const PageShell::DESIGN_STYLE() line 115
- method-call PageShell::bootstrap() line 116
public function topbar(list<array{string, string|null}> $crumbs, string $prefix): stringThe bar along the top of a page: the way into the navigation on a phone, the trail, the search and the theme.
The search box and the theme switch are hidden until the script that drives them has run, so a page read without it shows no control that does nothing.
Parameters
$crumbs | list<array{string, string|null}> | |
$prefix | string |
Returns
stringTest cases 1
Called from 1
Calls 1
- method-call PageShell::crumbs() line 133
public function crumbs(list<array{string, string|null}> $crumbs, string $prefix): stringThe trail shown along the top of a page.
Parameters
$crumbs | list<array{string, string|null}> | |
$prefix | string |
Returns
stringTest cases 1
Called from 1
Calls 2
- method-call HtmlText::escape() line 151
- function-call
implodeline 155
public function sidebar(
ReportSite $site,
string $page,
list<array{string, list<array{string, string, int|null, bool}>, string|null}> $blocks,
): stringThe navigation shown beside a page: the routes, then what the page itself is best left from.
Parameters
$site | ReportSite | |
$page | string | |
$blocks | list<array{string, list<array{string, string, int|null, bool}>, string|null}> |
Returns
stringTest cases 1
Called from 1
Calls 3
- method-call ReportSite::prefixOf() line 165
- method-call PageShell::routes() line 166
- method-call PageShell::block() line 168
public function routes(ReportSite $site, string $page): stringThe routes a reader can take to a statement, with what each one holds.
Parameters
$site | ReportSite | |
$page | string |
Returns
stringTest cases 1
Called from 1
Calls 16
- class-const ReportSite::INDEX() line 180
- class-const ReportSite::STATEMENTS() line 181
- method-call ReportSite::statistics() line 181
- class-const ReportSite::TABLES() line 182
- function-call
countline 182 - method-call ReportSite::tables() line 182
- class-const ReportSite::NAMESPACES() line 183
- method-call ReportSite::index() line 183
- class-const ReportSite::FILES() line 184
- method-call ReportSite::files() line 184
- class-const ReportSite::FINDINGS() line 185
- method-call ReportSite::prefixOf() line 187
- function-call
substrline 190 - function-call
str_starts_withline 191 - method-call HtmlText::escape() line 193
- method-call HtmlText::number() line 194
public function block(
string $title,
list<array{string, string, int|null, bool}> $items,
string|null $rest,
string $prefix,
): stringOne block of navigation: a title and the entries under it.
An address starting with # is a section of the page being read and is written as it is; any other is relative to the root of the report. A block of nothing but sections is the table of contents, and is marked so the section being read is followed as the page scrolls. A block longer than the limit is cut, and says where the rest are.
Parameters
$title | string | |
$items | list<array{string, string, int|null, bool}> | |
$rest | string|null | Where every entry is listed, for a block that had to be cut |
$prefix | string |
Returns
stringTest cases 2
Called from 1
Calls 6
- function-call
array_sliceline 219 - class-const PageShell::LIMIT() line 219
- function-call
str_starts_withline 220 - method-call HtmlText::escape() line 223
- method-call HtmlText::number() line 225
- function-call
countline 227
public function onThisPage(list<array{string, string}> $anchors): list<array{string, list<array{string, string, int|null, bool}>, string|null}>The sections of the page being read, as a block.
Parameters
$anchors | list<array{string, string}> |
Returns
list<array{string, list<array{string, string, int|null, bool}>, string|null}>Test cases 1
Called from 4
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:78
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:85
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:87
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:89
public function bootstrap(): stringThe inline script that restores the chosen theme before the page is laid out.
The theme is kept where document-design reads it, so the switch in the topbar and this script agree on what the reader chose.
Returns
stringTest cases 2
Called from 1
Calls 1
- class-const PageShell::THEME_KEY() line 262
Private surface 1§
Implementation details, listed for orientation only.
private HtmlText $textTest cases 17§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 11
PageShellTest::testBlockCutsALongListAndSaysWhereTheRestArecallsPageShellTest::testBlockWritesSectionsAsTheyAreAndPagesRelativeToTheRootcallsPageShellTest::testBootstrapRestoresTheChosenThemecallsPageShellTest::testCrumbsWriteTheTrailToThePagecallsPageShellTest::testHeadLoadsOnlyTheDocUiStylesheetcallsPageShellTest::testOnThisPageTurnsAnchorsIntoABlockcallsPageShellTest::testRenderIsWrittenExactlycallsPageShellTest::testRenderWritesOneCompleteDocumentWithLinksRelativeToTheRootcallsPageShellTest::testRoutesMarkTheRouteBeingReadAndCountWhatEachHoldscallsPageShellTest::testSidebarWritesTheRoutesAndThenWhatThePageIsLeftFromcallsPageShellTest::testTopbarCarriesTheTrailAndTheControlsTheScriptRevealscalls
Other tests reaching this symbol 6
ReporterInterfaceTestcallsHtmlReporterTest::testClassPagesWriteOneDocumentPerClasscallsHtmlReporterTest::testFilePagesWriteOneDocumentPerFilecallsHtmlReporterTest::testStatementPagesWriteOneDocumentPerStatementcallsHtmlReporterTest::testTablePagesWriteOneDocumentPerTablecallsReportAssetsTestcalls
Relations§
Instantiated in 1
Method calls 14
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:78
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:78
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:82
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:83
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:85
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:85
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:87
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:87
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:89
- method-call SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:89
- method-call SqlCatalog\Reporter\Html\HtmlReporter::tablePages() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:109
- method-call SqlCatalog\Reporter\Html\HtmlReporter::classPages() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:133
- method-call SqlCatalog\Reporter\Html\HtmlReporter::filePages() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:157
- method-call SqlCatalog\Reporter\Html\HtmlReporter::statementPages() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:181
Constant reads 7
- class-const SqlCatalog\Reporter\Html\HtmlReporter::render() packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:77
- class-const SqlCatalog\Reporter\Html\ReportAssets packages/sql-catalog/src/Reporter/Html/ReportAssets.php:31
- class-const SqlCatalog\Reporter\Html\ReportAssets packages/sql-catalog/src/Reporter/Html/ReportAssets.php:31
- class-const SqlCatalog\Reporter\Html\ReportAssets packages/sql-catalog/src/Reporter/Html/ReportAssets.php:32
- class-const SqlCatalog\Reporter\Html\ReportAssets packages/sql-catalog/src/Reporter/Html/ReportAssets.php:32
- class-const SqlCatalog\Reporter\Html\ReportAssets packages/sql-catalog/src/Reporter/Html/ReportAssets.php:33
- class-const SqlCatalog\Reporter\Html\ReportAssets packages/sql-catalog/src/Reporter/Html/ReportAssets.php:34
Type declarations 4
- type SqlCatalog\Reporter\Html\HtmlReporter packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:102
- type SqlCatalog\Reporter\Html\HtmlReporter packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:127
- type SqlCatalog\Reporter\Html\HtmlReporter packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:151
- type SqlCatalog\Reporter\Html\HtmlReporter packages/sql-catalog/src/Reporter/Html/HtmlReporter.php:175