Completed
Pull Request — 1.x (#19)
by IWASAKI
09:16 queued 05:43
created

OriginalTwigEnvironmentProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A get() 0 4 1
1
<?php
2
3
namespace Madapaja\TwigModule;
4
5
use Ray\Di\Di\Named;
6
use Ray\Di\ProviderInterface;
7
use Twig_LoaderInterface;
8
use Twig_Environment;
9
10
class OriginalTwigEnvironmentProvider implements ProviderInterface
11
{
12
    private $loader;
13
    private $options = [];
14
15
    /**
16
     * @Named("loader=twig_loader,options=Madapaja\TwigModule\Annotation\TwigOptions")
17
     */
18 21
    public function __construct(Twig_LoaderInterface $loader, array $options = [])
19
    {
20 21
        $this->loader = $loader;
21 21
        $this->options = $options;
22 21
    }
23
24
    /**
25
     * @return Twig_Environment
26
     */
27 21
    public function get()
28
    {
29 21
        return new Twig_Environment($this->loader, $this->options);
30
    }
31
}
32