Passed
Push — master ( 03e013...bd5966 )
by Anatoly
01:18 queued 14s
created

TwigFactory::createEnvironment()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
nc 1
nop 1
dl 0
loc 5
c 1
b 0
f 0
cc 1
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php declare(strict_types=1);
2
3
namespace App\Factory;
4
5
/**
6
 * Import classes
7
 */
8
use Twig\Loader\FilesystemLoader;
9
use Twig\Environment;
10
11
/**
12
 * TwigFactory
13
 *
14
 * Don't use this factory outside the container!
15
 */
16
final class TwigFactory
17
{
18
19
    /**
20
     * Creates Twig Environment instance
21
     *
22
     * @param array $params
23
     *
24
     * @return Environment
25
     */
26
    public function createEnvironment(array $params) : Environment
27
    {
28
        $loader = new FilesystemLoader($params['loader']['paths']);
29
30
        return new Environment($loader);
31
    }
32
}
33