Completed
Push — master ( 507aa8...65f31c )
by Vladimir
02:23
created

FinderFunction::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 2
dl 0
loc 9
ccs 0
cts 0
cp 0
crap 2
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace allejo\stakx\Twig;
4
5
use Symfony\Component\Finder\Finder;
6
use Twig_Environment;
7
8
class FinderFunction extends TwigFilesystem
9
{
10
    public function __invoke (Twig_Environment $env, $folderLocation)
11
    {
12
        parent::__invoke($env, $folderLocation);
13
14
        $finder = new Finder();
15
        $finder->in($folderLocation);
16
17
        return $finder;
18
    }
19
20 1
    public static function get ()
21
    {
22 1
        return new \Twig_SimpleFunction('finder', new self(), array(
23
            'needs_environment' => true
24 1
        ));
25
    }
26
}