Completed
Push — master ( a6c8f9...b97be3 )
by Vladimir
03:52 queued 19s
created

FileFunction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 57.14%

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 4
cts 7
cp 0.5714
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 6 1
A get() 0 6 1
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 implements StakxTwigFunction
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 1
    public static function get()
22
    {
23 1
        return new \Twig_SimpleFunction('file', new self(), array(
24 1
            'needs_environment' => true,
25 1
        ));
26
    }
27
}
28