Completed
Pull Request — master (#2)
by Tomáš
05:36
created

TPrefixedTranslatorAware::getPrefixedTranslator()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
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