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

EntityProperty   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
dl 0
loc 22
ccs 6
cts 7
cp 0.8571
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __get() 0 7 2
A __set() 0 4 2
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