Completed
Push — feature/0.7.0 ( b0ec67...8e24e4 )
by Ryuichi
04:29 queued 38s
created

EntityProperty::__set()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 6
rs 9.4285
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
    public function __set($name, $value)
16
    {
17
        if (property_exists($this, $name)) {
18
            $this->{$name} = $value;
19
        }
20
    }
21
22
    /**
23
     * overload getter
24
     */
25
    public function __get($name)
26
    {
27
        if (property_exists($this, $name)) {
28
            return $this->{$name};
29
        }
30
31
        return null;
32
    }
33
}
34