Completed
Push — 2.0-dev ( 1c6990...5642d2 )
by Takehiro
09:57
created

TestMock::__get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
class TestMock
4
{
5
    private $target;
6
7
    private function __construct($target)
8
    {
9
        $this->target = $target;
10
    }
11
12
    public static function on($target)
13
    {
14
        return new self($target);
15
    }
16
17
    public function __call($name, $args)
18
    {
19
        $method = new  ReflectionMethod($this->target, $name);
20
        $method->setAccessible(true);
21
22
        return $method->invokeArgs($this->target, $args);
23
    }
24
25
    public function __get($name)
26
    {
27
        $method = new  ReflectionProperty($this->target, $name);
28
        $method->setAccessible(true);
29
30
        return $method->getValue($this->target);
31
    }
32
}
33
34