TranslatorTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTranslator() 0 2 1
A setTranslator() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the core-bundle package.
5
 *
6
 * (c) 2018 WEBEWEB
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 WBW\Bundle\CoreBundle\Translation;
13
14
use Symfony\Contracts\Translation\TranslatorInterface;
15
16
/**
17
 * Translator trait.
18
 *
19
 * @author webeweb <https://github.com/webeweb>
20
 * @package WBW\Bundle\CoreBundle\Translation
21
 */
22
trait TranslatorTrait {
23
24
    /**
25
     * Translator.
26
     *
27
     * @var TranslatorInterface|null
28
     */
29
    private $translator;
30
31
    /**
32
     * Get the translator.
33
     *
34
     * @return TranslatorInterface|null Returns the translator.
35
     */
36
    public function getTranslator(): ?TranslatorInterface {
37
        return $this->translator;
38
    }
39
40
    /**
41
     * Set the translator.
42
     *
43
     * @param TranslatorInterface|null $translator The translator.
44
     * @return self Returns this instance.
45
     */
46
    protected function setTranslator(?TranslatorInterface $translator): self {
47
        $this->translator = $translator;
48
        return $this;
49
    }
50
}
51