Completed
Push — master ( 38f40f...304183 )
by Ryuichi
05:24
created

EntityProperty::__set()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace WebStream\Database;
3
4
/**
5
 * EntityPropertyクラス
6
 * @author Ryuichi Tanaka
7
 * @since 2017/05/29
8
 * @version 0.7
9
 */
10
trait EntityProperty
11
{
12
    /**
13
     * overload setter
14
     */
15 6
    public function __set($name, $value)
16
    {
17 6
        if (property_exists($this, $name)) {
18 6
            $this->{$name} = $value;
19
        }
20
    }
21
22
    /**
23
     * overload getter
24
     */
25 6
    public function __get($name)
26
    {
27 6
        if (property_exists($this, $name)) {
28 6
            return $this->{$name};
29
        }
30
31
        return null;
32
    }
33
}
34