Passed
Push — sudav3 ( d2f44f...2e4700 )
by 世昌
02:35
created

MagicArrayAccessTrait::offsetExists()   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 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)
22
    {
23
        return $this->__get($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