GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 2b815a...a1835d )
by
unknown
03:11
created

View::page()   B

Complexity

Conditions 7
Paths 13

Size

Total Lines 26
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 7
eloc 17
nc 13
nop 3
dl 0
loc 26
rs 8.8333
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the O2System PHP 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\Framework\Http;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Cache\Item;
19
use O2System\Framework\Http\Presenter\Meta;
20
use O2System\Framework\Http\Router\Datastructures\Page;
21
use O2System\Gear\Toolbar;
22
use O2System\Html;
23
use O2System\Psr\Cache\CacheItemPoolInterface;
24
use O2System\Psr\Patterns\Structural\Composite\RenderableInterface;
25
use O2System\Spl\Exceptions\ErrorException;
26
use O2System\Spl\Traits\Collectors\FileExtensionCollectorTrait;
27
use O2System\Spl\Traits\Collectors\FilePathCollectorTrait;
28
29
/**
30
 * Class View
31
 *
32
 * @package O2System
33
 */
34
class View implements RenderableInterface
35
{
36
    use FilePathCollectorTrait;
37
    use FileExtensionCollectorTrait;
38
39
    /**
40
     * View Config
41
     *
42
     * @var \O2System\Kernel\Datastructures\Config
43
     */
44
    protected $config;
45
46
    /**
47
     * View HTML Document
48
     *
49
     * @var Html\Document
50
     */
51
    protected $document;
52
53
    // ------------------------------------------------------------------------
54
55
    /**
56
     * View::__construct
57
     *
58
     * @return View
59
     */
60
    public function __construct()
61
    {
62
        $this->setFileDirName('Views');
63
        $this->addFilePath(PATH_APP);
64
65
        output()->addFilePath(PATH_APP);
66
67
        $this->config = config()->loadFile('view', true);
0 ignored issues
show
Bug introduced by
The method loadFile() does not exist on O2System\Kernel\Datastructures\Config. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

67
        $this->config = config()->/** @scrutinizer ignore-call */ loadFile('view', true);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Documentation Bug introduced by
It seems like config()->loadFile('view', true) can also be of type false. However, the property $config is declared as type O2System\Kernel\Datastructures\Config. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
68
69
        $this->setFileExtensions(
70
            [
71
                '.php',
72
                '.phtml',
73
            ]
74
        );
75
76
        if ($this->config->offsetExists('extensions')) {
77
            $this->setFileExtensions($this->config[ 'extensions' ]);
78
        }
79
80
        $this->document = new Html\Document();
81
        $this->document->formatOutput = (bool)$this->config->beautify;
82
    }
83
84
    /**
85
     * __get
86
     *
87
     * @param $property
88
     *
89
     * @return Parser|bool   Returns FALSE when property is not set.
90
     */
91
    public function &__get($property)
92
    {
93
        $get[ $property ] = false;
0 ignored issues
show
Comprehensibility Best Practice introduced by
$get was never initialized. Although not strictly required by PHP, it is generally a good practice to add $get = array(); before regardless.
Loading history...
94
95
        if (property_exists($this, $property)) {
96
            return $this->{$property};
97
        }
98
99
        return $get[ $property ];
100
    }
101
102
    public function parse($string, array $vars = [])
103
    {
104
        parser()->loadString($string);
105
106
        return parser()->parse($vars);
107
    }
108
109
    public function with($vars, $value = null)
110
    {
111
        if (is_string($vars)) {
112
            $vars = [$vars => $value];
113
        }
114
115
        presenter()->merge($vars);
116
117
        return $this;
118
    }
119
120
    public function load($filename, array $vars = [], $return = false)
121
    {
122
        if ($filename instanceof Page) {
123
            return $this->page($filename->getRealPath(), array_merge($vars, $filename->getVars()));
0 ignored issues
show
Bug introduced by
$filename->getVars() of type O2System\Spl\Datastructures\SplArrayObject is incompatible with the type array|null expected by parameter $array2 of array_merge(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

123
            return $this->page($filename->getRealPath(), array_merge($vars, /** @scrutinizer ignore-type */ $filename->getVars()));
Loading history...
Bug introduced by
Are you sure the usage of $this->page($filename->g... $filename->getVars())) targeting O2System\Framework\Http\View::page() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
124
        }
125
126
        if (strpos($filename, 'Pages') !== false) {
127
            return $this->page($filename, $vars, $return);
128
        }
129
130
        presenter()->merge($vars);
131
132
        if (false !== ($filePath = $this->getFilePath($filename))) {
133
            if ($return === false) {
134
135
                $partials = presenter()->get('partials');
136
137
                if ($partials->hasPartial('content') === false) {
138
                    $partials->addPartial('content', $filePath);
139
                } else {
140
                    $partials->addPartial(pathinfo($filePath, PATHINFO_FILENAME), $filePath);
141
                }
142
            } else {
143
                parser()->loadFile($filePath);
144
145
                return parser()->parse(presenter()->getArrayCopy());
146
            }
147
        } else {
148
            $vars = presenter()->getArrayCopy();
149
            extract($vars);
150
151
            $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
152
153
            $error = new ErrorException(
154
                'E_VIEW_NOT_FOUND',
155
                0,
156
                @$backtrace[ 0 ][ 'file' ],
157
                @$backtrace[ 0 ][ 'line' ],
158
                [trim($filename)]
159
            );
160
161
            unset($backtrace);
162
163
            ob_start();
164
            include output()->getFilePath('error');
0 ignored issues
show
Bug introduced by
The method getFilePath() does not exist on O2System\Kernel\Cli\Output. Did you maybe mean getFilePaths()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

164
            include output()->/** @scrutinizer ignore-call */ getFilePath('error');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
165
            $content = ob_get_contents();
166
            ob_end_clean();
167
168
            if ($return === false) {
169
                $partials = presenter()->get('partials');
170
171
                if ($partials->hasPartial('content') === false) {
172
                    $partials->addPartial('content', $content);
173
                } else {
174
                    $partials->addPartial(pathinfo($filePath, PATHINFO_FILENAME), $content);
0 ignored issues
show
Bug introduced by
It seems like $filePath can also be of type false; however, parameter $path of pathinfo() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

174
                    $partials->addPartial(pathinfo(/** @scrutinizer ignore-type */ $filePath, PATHINFO_FILENAME), $content);
Loading history...
175
                }
176
177
            } else {
178
                return $content;
179
            }
180
        }
181
    }
182
183
    public function page($filename, array $vars = [], $return = false)
184
    {
185
        if ($filename instanceof Page) {
186
            return $this->page($filename->getRealPath(), array_merge($vars, $filename->getVars()));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->page($filename->g... $filename->getVars())) targeting O2System\Framework\Http\View::page() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Bug introduced by
$filename->getVars() of type O2System\Spl\Datastructures\SplArrayObject is incompatible with the type array|null expected by parameter $array2 of array_merge(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

186
            return $this->page($filename->getRealPath(), array_merge($vars, /** @scrutinizer ignore-type */ $filename->getVars()));
Loading history...
187
        } else {
188
            $pageDirectories = modules()->getDirs('Pages');
0 ignored issues
show
Bug introduced by
The method getDirs() does not exist on O2System\Framework\Datastructures\Module. Did you maybe mean getDir()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

188
            $pageDirectories = modules()->/** @scrutinizer ignore-call */ getDirs('Pages');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
189
            foreach ($pageDirectories as $pageDirectory) {
190
                if (is_file($pageFilePath = $pageDirectory . $filename . '.phtml')) {
191
                    $filename = $pageFilePath;
192
                    break;
193
                }
194
            }
195
        }
196
197
        presenter()->merge($vars);
198
199
        if ($return === false) {
200
            $partials = presenter()->get('partials');
201
202
            if ($partials->hasPartial('content') === false) {
203
                $partials->addPartial('content', $filename);
204
            } else {
205
                $partials->addPartial(pathinfo($filename, PATHINFO_FILENAME), $filename);
206
            }
207
        } elseif (parser()->loadFile($filename)) {
208
            return parser()->parse(presenter()->getArrayCopy());
209
        }
210
    }
211
212
    public function modal($filename, array $vars = [])
213
    {
214
        if (presenter()->theme->hasLayout('modal')) {
0 ignored issues
show
Bug Best Practice introduced by
The property theme does not exist on O2System\Framework\Http\Presenter. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug introduced by
The method hasLayout() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

214
        if (presenter()->theme->/** @scrutinizer ignore-call */ hasLayout('modal')) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
215
            if (presenter()->theme->hasLayout('modal')) {
216
                presenter()->theme->setLayout('modal');
217
                echo $this->load($filename, $vars, true);
218
                exit(EXIT_SUCCESS);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
219
            }
220
        }
221
222
        presenter()->merge($vars);
223
224
        if (parser()->loadFile($filename)) {
225
            output()->send(parser()->parse(presenter()->getArrayCopy()));
0 ignored issues
show
Bug introduced by
The method send() does not exist on O2System\Kernel\Cli\Output. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

225
            output()->/** @scrutinizer ignore-call */ send(parser()->parse(presenter()->getArrayCopy()));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
226
        }
227
    }
228
229
    public function getFilePath($filename)
230
    {
231
        $filename = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $filename);
232
233
        if (is_file($filename)) {
234
            return realpath($filename);
235
        } else {
236
            $viewsFileExtensions = $this->fileExtensions;
237
            $viewsDirectories = modules()->getDirs('Views');
238
            $viewsDirectories = array_merge($viewsDirectories, $this->filePaths);
239
            $viewsDirectories = array_unique($viewsDirectories);
240
241
            $deviceDirectory = null;
0 ignored issues
show
Unused Code introduced by
The assignment to $deviceDirectory is dead and can be removed.
Loading history...
242
            if (services('userAgent')->isMobile()) {
0 ignored issues
show
Bug introduced by
The method isMobile() does not exist on O2System\Kernel\Containers\Services. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

242
            if (services('userAgent')->/** @scrutinizer ignore-call */ isMobile()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
243
                $deviceDirectory = 'mobile';
244
            }
245
246
            if (presenter()->theme->use === true) {
0 ignored issues
show
Bug Best Practice introduced by
The property theme does not exist on O2System\Framework\Http\Presenter. Since you implemented __get, consider adding a @property annotation.
Loading history...
247
248
                $moduleReplacementPath = presenter()->theme->active->getPathName()
249
                    . DIRECTORY_SEPARATOR
250
                    . 'views'
251
                    . DIRECTORY_SEPARATOR
252
                    . strtolower(
253
                        str_replace(PATH_APP, '', modules()->current()->getRealpath())
0 ignored issues
show
Bug introduced by
The method current() does not exist on O2System\Framework\Datastructures\Module. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

253
                        str_replace(PATH_APP, '', modules()->/** @scrutinizer ignore-call */ current()->getRealpath())

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
254
                    );
255
256
                if (is_dir($moduleReplacementPath)) {
257
                    array_unshift($viewsDirectories, $moduleReplacementPath);
258
259
                    // Add Theme File Extensions
260
                    if (presenter()->theme->active->getPresets()->offsetExists('extension')) {
261
                        array_unshift($viewsFileExtensions,
262
                            presenter()->theme->active->getPresets()->offsetGet('extension'));
263
                    } elseif (presenter()->theme->active->getPresets()->offsetExists('extensions')) {
264
                        $viewsFileExtensions = array_merge(
265
                            presenter()->theme->active->getPresets()->offsetGet('extensions'),
266
                            $viewsFileExtensions
267
                        );
268
                    }
269
270
                    // Add Theme Parser Engine
271
                    if (presenter()->theme->active->getPresets()->offsetExists('driver')) {
272
                        $parserDriverClassName = '\O2System\Parser\Drivers\\' . camelcase(
273
                                presenter()->theme->active->getPresets()->offsetGet('driver')
274
                            );
275
276
                        if (class_exists($parserDriverClassName)) {
277
                            parser()->addDriver(
278
                                new $parserDriverClassName(),
279
                                presenter()->theme->active->getPresets()->offsetGet('driver')
280
                            );
281
                        }
282
                    }
283
                }
284
            }
285
286
            foreach ($viewsDirectories as $viewsDirectory) {
287
                foreach ($viewsFileExtensions as $fileExtension) {
288
                    $filename = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $filename);
289
290
                    if (is_file($filePath = $viewsDirectory . $filename . $fileExtension)) {
291
                        return realpath($filePath);
292
                        break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
293
                    }
294
                }
295
            }
296
        }
297
298
        return false;
299
    }
300
301
    public function render(array $options = [])
302
    {
303
        if(profiler() !== false) {
0 ignored issues
show
introduced by
The condition profiler() !== false is always true.
Loading history...
304
            profiler()->watch('Starting View Rendering');
305
        }
306
        
307
        $htmlOutput = '';
308
        parser()->loadVars(presenter()->getArrayCopy());
309
310
        // set document meta title
311
        if (presenter()->meta->title instanceof Meta\Title) {
0 ignored issues
show
Bug Best Practice introduced by
The property meta does not exist on O2System\Framework\Http\Presenter. Since you implemented __get, consider adding a @property annotation.
Loading history...
312
            $this->document->title->text(presenter()->meta->title->__toString());
313
        }
314
315
        /**
316
         * Injecting Meta Opengraph
317
         */
318
        if (presenter()->meta->opengraph instanceof Meta\Opengraph) {
319
            // set opengraph title
320
            if (presenter()->meta->title instanceof Meta\Title) {
321
                presenter()->meta->opengraph->setTitle(presenter()->meta->title->__toString());
322
            }
323
324
            // set opengraph site name
325
            if (presenter()->exists('siteName')) {
326
                presenter()->meta->opengraph->setSiteName(presenter()->offsetGet('siteName'));
327
            }
328
329
            if (presenter()->meta->opengraph->count()) {
330
                $htmlElement = $this->document->getElementsByTagName('html')->item(0);
331
                $htmlElement->setAttribute('prefix', 'og: ' . presenter()->meta->opengraph->prefix);
332
333
                if (presenter()->meta->opengraph->exists('og:type') === false) {
334
                    presenter()->meta->opengraph->setType('website');
335
                }
336
337
                $opengraph = presenter()->meta->opengraph->getArrayCopy();
338
339
                foreach ($opengraph as $tag) {
340
                    $this->document->metaNodes->createElement($tag->attributes->getArrayCopy());
341
                }
342
            }
343
        }
344
345
        if (false !== ($controller = controller())) {
346
            presenter()->meta->offsetSet('module-controller', $controller->getClassInfo()->getParameter());
0 ignored issues
show
Bug introduced by
The method offsetSet() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

346
            presenter()->meta->/** @scrutinizer ignore-call */ 
347
                               offsetSet('module-controller', $controller->getClassInfo()->getParameter());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
347
        }
348
349
        $meta = presenter()->meta->getArrayCopy();
350
351
        foreach ($meta as $tag) {
352
            $this->document->metaNodes->createElement($tag->attributes->getArrayCopy());
353
        }
354
355
        if (presenter()->theme->use === true) {
0 ignored issues
show
Bug Best Practice introduced by
The property theme does not exist on O2System\Framework\Http\Presenter. Since you implemented __get, consider adding a @property annotation.
Loading history...
356
            presenter()->theme->load();
357
            if (false !== ($layout = presenter()->theme->active->getLayout())) {
358
                parser()->loadFile($layout->getRealPath());
359
                $htmlOutput = parser()->parse();
360
            }
361
        } else {
362
            $this->document->find('body')->append(presenter()->partials->__get('content'));
0 ignored issues
show
Bug introduced by
The method __get() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

362
            $this->document->find('body')->append(presenter()->partials->/** @scrutinizer ignore-call */ __get('content'));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug Best Practice introduced by
The property partials does not exist on O2System\Framework\Http\Presenter. Since you implemented __get, consider adding a @property annotation.
Loading history...
363
        }
364
365
        $this->document->loadHTML(presenter()->assets->parseSourceCode($htmlOutput));
0 ignored issues
show
Bug introduced by
The method parseSourceCode() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

365
        $this->document->loadHTML(presenter()->assets->/** @scrutinizer ignore-call */ parseSourceCode($htmlOutput));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug Best Practice introduced by
The property assets does not exist on O2System\Framework\Http\Presenter. Since you implemented __get, consider adding a @property annotation.
Loading history...
366
        
367
        /**
368
         * Injecting Single Sign-On (SSO) iFrame
369
         */
370
        if (services()->has('user')) {
371
            $iframe = services()->get('user')->getIframeCode();
372
373
            if ( ! empty($iframe)) {
374
                $this->document->find('body')->append($iframe);
375
            }
376
        }
377
378
        if (input()->env('DEBUG_STAGE') === 'DEVELOPER' and
379
            config()->getItem('presenter')->debugToolBar === true and
0 ignored issues
show
Bug introduced by
The method getItem() does not exist on O2System\Kernel\Datastructures\Config. Did you maybe mean getIterator()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

379
            config()->/** @scrutinizer ignore-call */ getItem('presenter')->debugToolBar === true and

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
380
            services()->has('profiler')
381
        ) {
382
            $this->document->find('body')->append((new Toolbar())->__toString());
383
        }
384
385
        /**
386
         * Injecting Progressive Web Application (PWA) Manifest
387
         */
388
        $this->document->linkNodes->createElement([
389
            'rel'  => 'manifest',
390
            'href' => '/manifest.json',
391
        ]);
392
393
        $htmlOutput = $this->document->saveHTML();
394
395
        // Uglify Output
396
        if ($this->config->output['uglify'] === true) {
397
            $htmlOutput = preg_replace(
398
                [
399
                    '/\>[^\S ]+/s',     // strip whitespaces after tags, except space
400
                    '/[^\S ]+\</s',     // strip whitespaces before tags, except space
401
                    '/(\s)+/s',         // shorten multiple whitespace sequences
402
                    '/<!--(.|\s)*?-->/', // Remove HTML comments
403
                    '/<!--(.*)-->/Uis',
404
                    "/[[:blank:]]+/",
405
                ],
406
                [
407
                    '>',
408
                    '<',
409
                    '\\1',
410
                    '',
411
                    '',
412
                    ' ',
413
                ],
414
                str_replace(["\n", "\r", "\t"], '', $htmlOutput));
415
        }
416
417
        // Beautify Output
418
        if ($this->config->output['beautify'] === true) {
419
            $beautifier = new Html\Dom\Beautifier();
420
            $htmlOutput = $beautifier->format($htmlOutput);
421
        }
422
423
        if(profiler() !== false) {
0 ignored issues
show
introduced by
The condition profiler() !== false is always true.
Loading history...
424
            profiler()->watch('Ending View Rendering');
425
        }
426
427
        return $htmlOutput;
428
    }
429
}
430