Completed
Push — master ( c2b5cc...89bfcf )
by Vladimir
03:33
created

FileFunction::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 3
cp 0
crap 2
1
<?php
2
3
/**
4
 * @copyright 2017 Vladimir Jimenez
5
 * @license   https://github.com/allejo/stakx/blob/master/LICENSE.md MIT
6
 */
7
8
namespace allejo\stakx\Twig;
9
10
use Twig_Environment;
11
12
class FileFunction extends TwigFilesystem
13
{
14
    public function __invoke(Twig_Environment $env, $filePath)
15
    {
16
        parent::__invoke($env, $filePath);
17
18
        return file_get_contents($this->path);
19
    }
20
21 14
    public static function get()
22
    {
23 14
        return new \Twig_SimpleFunction('file', new self(), array(
24 14
            'needs_environment' => true,
25
        ));
26
    }
27
}
28