PrivateGetter::__get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Teto\Object;
4
5
/**
6
 * Private property behaves like read only.
7
 *
8
 * NOTICE: You may not be able to imagine the behavior of this trait in the inherited class.
9
 *
10
 * @see \Teto\Object\PrivateGetterTest
11
 *
12
 * @author    USAMI Kenta <[email protected]>
13
 * @copyright 2016 Baguette HQ
14
 * @license   http://www.apache.org/licenses/LICENSE-2.0
15
 */
16
trait PrivateGetter
17
{
18 10
    public function __get($name)
19
    {
20 10
        return $this->$name;
21
    }
22
23 3
    public function __isset($name)
24
    {
25 3
        return isset($this->$name);
26
    }
27
}
28