Conditions | 5 |
Paths | 12 |
Total Lines | 27 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public function __construct($options = []) |
||
19 | { |
||
20 | if(is_string($options)) |
||
21 | { |
||
22 | $this->title = $options; |
||
23 | $options = []; |
||
24 | } |
||
25 | $root = __DIR__; |
||
26 | if(empty($options['root'])) |
||
27 | { |
||
28 | $trace = debug_backtrace(null, 1); |
||
29 | $root = dirname($trace[0]['file']); |
||
30 | } |
||
31 | $defaults = [ |
||
32 | 'root' => $root, |
||
33 | 'path' => '.', |
||
34 | 'skipLevel' => 1 |
||
35 | ]; |
||
36 | foreach ($defaults as $name => $value) |
||
37 | { |
||
38 | if (!array_key_exists($name, $options)) |
||
39 | { |
||
40 | $options[$name] = $value; |
||
41 | } |
||
42 | } |
||
43 | parent::__construct($options); |
||
44 | } |
||
45 | |||
55 | } |