Completed
Push — master ( f9c2c5...1af469 )
by Kyle
39:40 queued 35:46
created

BPClone   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 9
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 29
ccs 13
cts 13
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B __get() 0 13 5
A __call() 0 4 3
1
<?php
2
3
namespace BootPress\Theme;
4
5
class BPClone
6
{
7
    private $class;
8
    private $clone = array();
9
10 2
    public function __construct($class = null)
11
    {
12 2
        $this->class = $class;
13 2
    }
14
15 16
    public function __get($name)
16
    {
17 16
        $property = ($this->class) ? $this->class->$name : null;
18 16
        if (is_object($property) || is_null($property)) {
19 15
            if (!isset($this->clone[$name])) {
20 1
                $this->clone[$name] = new BPClone($property);
21 1
            }
22
            
23 15
            return $this->clone[$name];
24
        }
25
        
26 12
        return $property;
27
    }
28
29 19
    public function __call($name, $arguments)
30
    {
31 19
        return ($this->class && is_callable(array($this->class, $name))) ? call_user_func_array(array($this->class, $name), $arguments) : null;
32
    }
33
}
34