Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
3 / 3 |
MagicProperties | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
3 / 3 |
__get | n/a |
0 / 0 |
0 | n/a |
0 / 0 |
|||||
__set | |
100.00% |
1 / 1 |
2 | |
100.00% |
2 / 2 |
|||
__isset | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
1 | <?php declare(strict_types=1); |
2 | |
3 | namespace Aviat\Kilo\Traits; |
4 | |
5 | trait MagicProperties { |
6 | abstract public function __get(string $name); |
7 | |
8 | public function __set(string $name, mixed $value): void |
9 | { |
10 | if (property_exists($this, $name)) |
11 | { |
12 | $this->$name = $value; |
13 | } |
14 | } |
15 | |
16 | public function __isset(string $name): bool |
17 | { |
18 | return isset($this->$name); |
19 | } |
20 | } |