EntityProperty   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 26
rs 10
wmc 4

2 Methods

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