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

EntityProperty   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 4
lcom 0
cbo 0

2 Methods

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