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.

FileExtension::fileContents()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace Application\Twig;
4
5
/**
6
 * @author Borut Balažek <[email protected]>
7
 */
8
class FileExtension extends \Twig_Extension
9
{
10
    /**
11
     * @return string
12
     */
13
    public function getName()
14
    {
15
        return 'application/file';
16
    }
17
18
    /**
19
     * @return \Twig_SimpleFunction[]
20
     */
21
    public function getFunctions()
22
    {
23
        return array(
24
            new \Twig_SimpleFunction(
25
                'file_contents',
26
                array(
27
                    $this,
28
                    'fileContents',
29
                ),
30
                array(
31
                    'is_safe' => array('html'),
32
                )
33
            ),
34
        );
35
    }
36
37
    /**
38
     * @return string|false
39
     */
40
    public function fileContents($path)
41
    {
42
        $path = ROOT_DIR.'/'.$path;
43
44
        if (file_exists($path)) {
45
            return file_get_contents($path);
46
        }
47
48
        return false;
49
    }
50
}
51