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