Passed
Push — master ( 6acad1...7c550d )
by Petr
08:00
created

TLang::getStLang()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

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