Completed
Pull Request — master (#2)
by Tomáš
09:22
created

TPrefixedTranslatorAware   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getPrefixedTranslator() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SixtyEightPublishers\User\Common\Translator;
6
7
use Nette;
8
9
trait TPrefixedTranslatorAware
10
{
11
	use TTranslatorAware;
12
13
	/** @var NULL|\Nette\Localization\ITranslator  */
14
	private $prefixedTranslator;
15
16
	/**
17
	 * @return \Nette\Localization\ITranslator
18
	 */
19
	public function getPrefixedTranslator(): Nette\Localization\ITranslator
20
	{
21
		if (NULL === $this->prefixedTranslator) {
22
			$this->prefixedTranslator = PrefixedTranslator::createFromClassName($this->getTranslator(), static::class);
23
		}
24
25
		return $this->prefixedTranslator;
26
	}
27
}
28