blob: 68bc98a4e1d8de719f4f35945713c50cbc41b49b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<?php
/**
* Minimal test stub for the global Page base class normally defined in index.php.
*
* Provides a harness to call doPreprocess()/doRender() from tests and exposes
* static helpers used by production code (Page::getModule()).
*/
abstract class Page
{
private static ?Page $current = null;
protected string $identifier = '';
public function __construct(string $identifier = '')
{
$this->identifier = $identifier;
self::$current = $this;
}
public static function getModule(): ?Page
{
return self::$current;
}
public function getIdentifier(): string
{
return $this->identifier ?: static::class;
}
public function preprocess(): void
{
$this->doPreprocess();
}
public function render(): void
{
$this->doRender();
}
// Methods the module is expected to implement
abstract protected function doPreprocess();
abstract protected function doRender();
}
|