TLang   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 7
c 1
b 0
f 1
dl 0
loc 16
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setSmLang() 0 4 1
A getSmLang() 0 6 2
1
<?php
2
3
namespace kalanis\kw_semaphore\Traits;
4
5
6
use kalanis\kw_semaphore\Interfaces\ISMTranslations;
7
use kalanis\kw_semaphore\Translations;
8
9
10
/**
11
 * Trait TLang
12
 * @package kalanis\kw_semaphore\Traits
13
 * Translations
14
 */
15
trait TLang
16
{
17
    protected ?ISMTranslations $smLang = null;
18
19 14
    public function setSmLang(?ISMTranslations $lang = null): self
20
    {
21 14
        $this->smLang = $lang;
22 14
        return $this;
23
    }
24
25 6
    public function getSmLang(): ISMTranslations
26
    {
27 6
        if (empty($this->smLang)) {
28 6
            $this->smLang = new Translations();
29
        }
30 6
        return $this->smLang;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->smLang could return the type null which is incompatible with the type-hinted return kalanis\kw_semaphore\Interfaces\ISMTranslations. Consider adding an additional type-check to rule them out.
Loading history...
31
    }
32
}
33