1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace Plaisio; |
5
|
|
|
|
6
|
|
|
use Plaisio\Kernel\Nub; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* The heart of the Plaisio system and parent class for all kernels. |
10
|
|
|
*/ |
11
|
|
|
#[\AllowDynamicProperties] |
12
|
|
|
abstract class PlaisioKernel implements PlaisioInterface |
13
|
|
|
{ |
14
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
15
|
|
|
/** |
16
|
|
|
* @deprecated |
17
|
|
|
* |
18
|
|
|
* @var int |
19
|
|
|
*/ |
20
|
|
|
public int $pagIdIndex; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @deprecated |
24
|
|
|
* |
25
|
|
|
* @var array|null |
26
|
|
|
*/ |
27
|
|
|
public ?array $pageInfo = null; |
28
|
|
|
|
29
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
30
|
|
|
/** |
31
|
|
|
* PlaisioKernel constructor. |
32
|
2 |
|
*/ |
33
|
|
|
public function __construct() |
34
|
2 |
|
{ |
35
|
2 |
|
$this->nub = $this; |
|
|
|
|
36
|
2 |
|
Nub::$nub = $this; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
40
|
|
|
/** |
41
|
|
|
* Returns the value of a property. |
42
|
|
|
* |
43
|
|
|
* Do not call this method directly as it is a PHP magic method that |
44
|
|
|
* will be implicitly called when executing `$value = $object->property;`. |
45
|
|
|
* |
46
|
|
|
* @param string $property The name of the property. |
47
|
|
|
* |
48
|
|
|
* @return mixed The value of the property. |
49
|
|
|
* |
50
|
|
|
* @throws \LogicException If the property is not defined. |
51
|
2 |
|
*/ |
52
|
|
|
public function __get(string $property) |
53
|
2 |
|
{ |
54
|
2 |
|
$getter = 'get'.ucfirst($property); |
55
|
|
|
if (method_exists($this, $getter)) |
56
|
1 |
|
{ |
57
|
|
|
return $this->$property = $this->$getter(); |
58
|
|
|
} |
59
|
1 |
|
|
60
|
|
|
throw new \LogicException(sprintf('Unknown property %s::%s', __CLASS__, $property)); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
64
|
|
|
/** |
65
|
|
|
* Returns the URL of the login page. |
66
|
|
|
* |
67
|
|
|
* @param string|null $redirect After a successful login the user agent must be redirected to this URL. |
68
|
|
|
* |
69
|
|
|
* @return string |
70
|
|
|
* @deprecated |
71
|
|
|
*/ |
72
|
|
|
public function getLoginUrl(?string $redirect = null): string |
73
|
|
|
{ |
74
|
|
|
unset($redirect); |
75
|
|
|
|
76
|
|
|
throw new \LogicException('Not implemented'); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
//-------------------------------------------------------------------------------------------------------------------- |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
//---------------------------------------------------------------------------------------------------------------------- |
83
|
|
|
|