Completed
Push — master ( 0ba1b3...937b8a )
by Vladimir
02:47
created

FinderFunction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 37.5%

Importance

Changes 0
Metric Value
dl 0
loc 19
ccs 3
cts 8
cp 0.375
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 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 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
        ));
30
    }
31
}
32