Passed
Push — sudav3 ( 36433a...9b090b )
by 世昌
02:24
created

PropertyDataTrait::__isset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace suda\orm\struct;
3
4
trait PropertyDataTrait
5
{
6
    
7
    public function offsetSet($offset, $value)
8
    {
9
        $this->__set($offset, $value);
10
    }
11
12
    public function offsetExists($offset)
13
    {
14
        return $this->__isset($offset);
15
    }
16
17
    public function offsetUnset($offset)
18
    {
19
        $this->__unset($offset);
20
    }
21
22
    public function offsetGet($offset)
23
    {
24
        return $this->__get($offset);
25
    }
26
    
27
    /**
28
     * 设置值
29
     *
30
     * @param string $name
31
     * @param mixed $value
32
     */
33
    public function __set(string $name, $value)
34
    {
35
        $this->$name = $value;
36
    }
37
    
38
    /**
39
     * 获取参数值
40
     *
41
     * @param string $name
42
     * @return mixed
43
     */
44
    public function __get(string $name)
45
    {
46
        return $this->$name;
47
    }
48
49
    /**
50
     * 判断是否设置
51
     *
52
     * @param string $name
53
     * @return boolean
54
     */
55
    public function __isset(string $name)
56
    {
57
        return isset($this->$name);
58
    }
59
60
    /**
61
     * 取消设置值
62
     *
63
     * @param string $name
64
     */
65
    public function __unset(string $name)
66
    {
67
        unset($this->$name);
68
    }
69
}
70