PageClone   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __get() 0 4 1
B __call() 0 13 7
1
<?php
2
3
namespace BootPress\Theme;
4
5
use BootPress\Page\Component as Page;
6
7
class PageClone
8
{
9
    // http://www.smarty.net/forums/viewtopic.php?p=64771
10
    // http://www.garfieldtech.com/blog/magic-benchmarks
11
12
    public $additional = array();
13
    private $methods = array();
14
15 14
    public function __construct()
16
    {
17 14
        $this->methods = array('url', 'set', 'meta', 'link', 'style', 'script', 'jquery', 'filter');
18 3
    }
19
20 3
    public function __get($name)
21
    {
22 3
        return Page::html()->$name;
23
    }
24
25 17
    public function __call($name, $arguments)
26
    {
27 17
        if (in_array($name, $this->methods)) {
28 17
            if ($name == 'filter' && !in_array($arguments[1], array('prepend', 'append'))) {
29 1
                return;
30
            }
31 17
            $result = call_user_func_array(array(Page::html(), $name), $arguments);
32 17
        } elseif (isset($this->additional[$name])) {
33 12
            $result = call_user_func_array($this->additional[$name], $arguments);
34 12
        }
35
36 17
        return (isset($result) && !is_object($result)) ? $result : null;
37
    }
38
}
39