Completed
Push — master ( b785dd...3df4eb )
by Vladimir
03:46
created

FinderFunction::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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 Symfony\Component\Finder\Finder;
11
use Twig_Environment;
12
13
class FinderFunction extends TwigFilesystem
14
{
15
    public function __invoke(Twig_Environment $env, $folderLocation)
16
    {
17
        parent::__invoke($env, $folderLocation);
18
19
        $finder = new Finder();
20
        $finder->in($folderLocation);
21
22
        return $finder;
23
    }
24
25 2
    public static function get()
26
    {
27 2
        return new \Twig_SimpleFunction('finder', new self(), array(
28 2
            'needs_environment' => true,
29 2
        ));
30
    }
31
}
32