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

FinderFunction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 6 1
A __invoke() 0 9 1
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
}