Completed
Push — master ( 0e9f9c...65c20f )
by Kyle
03:24
created

BPClone   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 69.23%

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 9
cts 13
cp 0.6923
rs 10

3 Methods

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