Total Complexity | 5 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
17 | class PregObject |
||
18 | { |
||
19 | |||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $data = []; |
||
24 | |||
25 | /** |
||
26 | * PregObject constructor. |
||
27 | * |
||
28 | * @param int $flags |
||
29 | * @param int $offset |
||
30 | */ |
||
31 | 2 | public function __construct($flags = 0, $offset = 0) |
|
32 | { |
||
33 | 2 | $this->flags = $flags; |
|
34 | 2 | $this->offset = $offset; |
|
35 | 2 | } |
|
36 | |||
37 | /** |
||
38 | * @param string $name |
||
39 | * |
||
40 | * @return mixed |
||
41 | */ |
||
42 | 2 | public function &__get($name) |
|
43 | { |
||
44 | 2 | if (!Arr::keyExists($this->data, $name)) |
|
45 | { |
||
46 | 2 | $this->data[$name] = null; |
|
47 | } |
||
48 | |||
49 | 2 | return $this->data[$name]; |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * @param string $name |
||
54 | * @param mixed $value |
||
55 | */ |
||
56 | 2 | public function __set($name, $value) |
|
57 | { |
||
58 | 2 | $this->data[$name] = $value; |
|
59 | 2 | } |
|
60 | |||
61 | /** |
||
62 | * @param string $name |
||
63 | * |
||
64 | * @return bool |
||
65 | */ |
||
66 | 2 | public function __isset($name) |
|
69 | } |
||
70 | |||
71 | } |
||
72 |