TLang::getAusLang()   A
last analyzed

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
nc 2
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace kalanis\kw_auth_sources\Traits;
4
5
6
use kalanis\kw_auth_sources\Interfaces\IKAusTranslations;
7
use kalanis\kw_auth_sources\Translations;
8
9
10
/**
11
 * Trait TLang
12
 * @package kalanis\kw_auth_sources\Traits
13
 */
14
trait TLang
15
{
16
    protected ?IKAusTranslations $ausLang = null;
17
18 128
    public function setAusLang(?IKAusTranslations $ausLang = null): void
19
    {
20 128
        $this->ausLang = $ausLang;
21 128
    }
22
23 88
    public function getAusLang(): IKAusTranslations
24
    {
25 88
        if (empty($this->ausLang)) {
26 87
            $this->ausLang = new Translations();
27
        }
28 88
        return $this->ausLang;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->ausLang could return the type null which is incompatible with the type-hinted return kalanis\kw_auth_sources\...faces\IKAusTranslations. Consider adding an additional type-check to rule them out.
Loading history...
29
    }
30
}
31