TranslationManagerResource::getResource()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 0
crap 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