EntityProperty::__set()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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