TemplateFinder::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * This file is part of the Madapaja.TwigModule package.
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace Madapaja\TwigModule;
8
9
class TemplateFinder implements TemplateFinderInterface
10
{
11
    const PHP_EXT = '.php';
12
13
    const TWIG_EXT = '.html.twig';
14
15
    /**
16
     * {@inheritdoc}
17
     */
18 9
    public function __invoke($name)
19
    {
20 9
        $pos = strrpos($name, self::PHP_EXT);
21 9
        $file = substr($name, 0, $pos) . self::TWIG_EXT;
22
23 9
        return $file;
24
    }
25
}
26