Completed
Push — master ( e84659...ad6336 )
by P.R.
02:22
created

PlaisioKernel   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 4
eloc 11
c 3
b 1
f 0
dl 0
loc 65
ccs 9
cts 12
cp 0.75
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __get() 0 9 2
A getLoginUrl() 0 5 1
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;
0 ignored issues
show
Bug introduced by
The property nub is declared read-only in Plaisio\PlaisioKernel.
Loading history...
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