TranslationManagerResource   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 39
rs 10
c 0
b 0
f 0
ccs 9
cts 9
cp 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isFresh() 0 4 1
A getResource() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the AsmTranslationLoaderBundle package.
5
 *
6
 * (c) Marc Aschmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Asm\TranslationLoaderBundle\Config\Resource;
13
14
use Asm\TranslationLoaderBundle\Translation\DatabaseLoader;
15
use Symfony\Component\Config\Resource\ResourceInterface;
16
17
/**
18
 * Resource plugging the TranslationManager into the Symfony Translator.
19
 *
20
 * @author Christian Flothmann <[email protected]>
21
 */
22
class TranslationManagerResource implements ResourceInterface
23
{
24
    /**
25
     * @var DatabaseLoader
26
     */
27
    private $loader;
28
29
    /**
30
     * @param DatabaseLoader $loader
31
     */
32 2
    public function __construct(DatabaseLoader $loader)
33
    {
34 2
        $this->loader = $loader;
35 2
    }
36
37
    /**
38
     * {@inheritDoc}
39
     */
40 1
    public function isFresh($timestamp)
41
    {
42 1
        return $this->loader->isFresh($timestamp);
43
    }
44
45
    /**
46
     * {@inheritDoc}
47
     */
48 1
    public function getResource()
49
    {
50 1
        return $this->loader;
51
    }
52
53
    /**
54
     * {@inheritDoc}
55
     */
56 1
    public function __toString()
57
    {
58 1
        return 'DatabaseLoader';
59
    }
60
}
61