Completed
Pull Request — master (#70)
by Martin
02:14
created

TwitalLoaderTwigGte3   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
cbo 2
dl 0
loc 31
c 0
b 0
f 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getSourceContext() 0 6 1
A getCacheKey() 0 4 1
A isFresh() 0 4 1
A exists() 0 4 1
1
<?php
2
3
namespace Goetas\Twital;
4
5
use Twig\Loader\LoaderInterface;
6
use Twig\Source;
7
8
/**
9
 * @author Martin Hasoň <[email protected]>
10
 */
11
abstract class TwitalLoaderTwigGte3 implements LoaderInterface
12
{
13
    use TwitalLoaderTrait;
14
15
    public function __construct(LoaderInterface $loader = null, Twital $twital = null, $addDefaults = true)
16
    {
17
        $this->doConstruct($loader, $twital, $addDefaults);
18
    }
19
20
    public function getSourceContext(string $name): Source
21
    {
22
        $context = $this->doGetSourceContext($name);
23
24
        return new Source($context[0], $context[1], $context[2]);
25
    }
26
27
    public function getCacheKey(string $name): string
28
    {
29
        return $this->loader->getCacheKey($name);
30
    }
31
32
    public function isFresh(string $name, int $time): bool
33
    {
34
        return $this->loader->isFresh($name, $time);
35
    }
36
37
    public function exists(string $name)
38
    {
39
        return $this->doExists($name);
40
    }
41
}
42