Passed
Push — master ( cb2d88...e8a992 )
by Petr
08:25
created

TLang::setLang()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 1
1
<?php
2
3
namespace kalanis\kw_files\Traits;
4
5
6
use kalanis\kw_files\Interfaces\IFLTranslations;
7
use kalanis\kw_files\Translations;
8
9
10
/**
11
 * Trait TLang
12
 * @package kalanis\kw_files\Processing
13
 * Translations trait
14
 */
15
trait TLang
16
{
17
    /** @var IFLTranslations|null */
18
    protected $lang = null;
19
20 83
    public function setLang(?IFLTranslations $lang = null): void
21
    {
22 83
        $this->lang = $lang;
23 83
    }
24
25 44
    public function getLang(): IFLTranslations
26
    {
27 44
        if (empty($this->lang)) {
28 44
            $this->lang = new Translations();
29
        }
30 44
        return $this->lang;
31
    }
32
}
33