Total Complexity | 4 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
4 | trait MagicArrayAccessTrait |
||
5 | { |
||
6 | public function offsetSet($offset, $value) |
||
7 | { |
||
8 | $this->__set($offset, $value); |
||
9 | } |
||
10 | |||
11 | public function offsetExists($offset) |
||
12 | { |
||
13 | return $this->__isset($offset); |
||
14 | } |
||
15 | |||
16 | public function offsetUnset($offset) |
||
17 | { |
||
18 | $this->__unset($offset); |
||
19 | } |
||
20 | |||
21 | public function offsetGet($offset) |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * 设置值 |
||
28 | * |
||
29 | * @param string $name |
||
30 | * @param mixed $value |
||
31 | */ |
||
32 | abstract public function __set(string $name, $value); |
||
33 | |||
34 | /** |
||
35 | * 获取参数值 |
||
36 | * |
||
37 | * @param string $name |
||
38 | * @return mixed |
||
39 | */ |
||
40 | abstract public function __get(string $name); |
||
41 | |||
42 | /** |
||
43 | * 判断是否设置 |
||
44 | * |
||
45 | * @param string $name |
||
46 | * @return boolean |
||
47 | */ |
||
48 | abstract public function __isset(string $name); |
||
49 | |||
50 | /** |
||
51 | * 取消设置值 |
||
52 | * |
||
53 | * @param string $name |
||
54 | */ |
||
55 | abstract public function __unset(string $name); |
||
56 | } |
||
57 |