Completed
Push — master ( d404ac...fc4cfb )
by Alexander
10:24 queued 07:21
created

Highlighter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 17
c 1
b 0
f 0
rs 10
1
<?php
2
/*
3
 * Go! AOP framework
4
 *
5
 * @copyright Copyright 2015, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Demo;
12
13
/**
14
 * Highlighter utility class
15
 */
16
final class Highlighter
17
{
18
    /**
19
     * Highlighter with built-in check for list of disabled function (Google AppEngine)
20
     *
21
     * @param string $file Name of the file
22
     */
23
    public static function highlight($file)
24
    {
25
        $highlightFileFunc = new \ReflectionFunction('highlight_file');
26
        if (!$highlightFileFunc->isDisabled()) {
27
            highlight_file($file);
28
        } else {
29
            echo '<pre>' . htmlspecialchars(file_get_contents($file)) . '</pre>';
30
        }
31
    }
32
}
33