TTranslate   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setTranslation() 0 3 1
A getTranslation() 0 6 2
1
<?php
2
3
namespace kalanis\kw_files_mapper\Support;
4
5
6
/**
7
 * Trait TTranslate
8
 * @package kalanis\kw_files_mapper\Support
9
 * Convert content
10
 */
11
trait TTranslate
12
{
13
    protected ?Process\Translate $translation = null;
14
15 136
    public function setTranslation(?Process\Translate $translation = null): void
16
    {
17 136
        $this->translation = $translation;
18 136
    }
19
20 88
    public function getTranslation(): Process\Translate
21
    {
22 88
        if (empty($this->translation)) {
23 70
            $this->translation = new Process\Translate();
24
        }
25 88
        return $this->translation;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->translation could return the type null which is incompatible with the type-hinted return kalanis\kw_files_mapper\Support\Process\Translate. Consider adding an additional type-check to rule them out.
Loading history...
26
    }
27
}
28