1 | <?php |
||
2 | /** |
||
3 | * This file is part of the O2System Framework package. |
||
4 | * |
||
5 | * For the full copyright and license information, please view the LICENSE |
||
6 | * file that was distributed with this source code. |
||
7 | * |
||
8 | * @author Steeve Andrian Salim |
||
9 | * @copyright Copyright (c) Steeve Andrian Salim |
||
10 | */ |
||
11 | |||
12 | // ------------------------------------------------------------------------ |
||
13 | |||
14 | namespace O2System\Gear; |
||
15 | |||
16 | // ------------------------------------------------------------------------ |
||
17 | |||
18 | use O2System\Gear\Profiler\DataStructures\Metric; |
||
19 | |||
20 | /** |
||
21 | * Class Browser |
||
22 | * |
||
23 | * @package O2System\Gear |
||
24 | */ |
||
25 | class Browser |
||
26 | { |
||
27 | /** |
||
28 | * Browser::$expression |
||
29 | * |
||
30 | * @var mixed |
||
31 | */ |
||
32 | private $expression; |
||
33 | |||
34 | // ------------------------------------------------------------------------ |
||
35 | |||
36 | /** |
||
37 | * Browser::__construct |
||
38 | * |
||
39 | * @param mixed $expression |
||
40 | */ |
||
41 | public function __construct($expression) |
||
42 | { |
||
43 | $this->expression = var_format($expression); |
||
44 | } |
||
45 | |||
46 | // ------------------------------------------------------------------------ |
||
47 | |||
48 | /** |
||
49 | * Browser::render |
||
50 | * |
||
51 | * @return false|string |
||
52 | */ |
||
53 | public function render() |
||
54 | { |
||
55 | $metric = new Metric('print-out'); |
||
56 | $metric->start(); |
||
57 | ini_set('memory_limit', '512M'); |
||
58 | |||
59 | if ( ! is_string($this->expression)) { |
||
60 | $this->expression = print_r($this->expression, true); |
||
61 | } |
||
62 | |||
63 | $expression = htmlentities($this->expression); |
||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||
64 | $expression = htmlspecialchars(htmlspecialchars_decode($this->expression, ENT_QUOTES), ENT_QUOTES, 'UTF-8'); |
||
65 | $trace = new Trace(); |
||
66 | |||
67 | $metric->stop(); |
||
68 | |||
69 | ob_start(); |
||
70 | include __DIR__ . '/Views/Screen.php'; |
||
71 | $output = ob_get_contents(); |
||
72 | ob_end_clean(); |
||
73 | |||
74 | return $output; |
||
75 | } |
||
76 | } |