PageClone::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
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