Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
8 / 8 |
|
90.91% |
10 / 11 |
|
50.00% |
5 / 10 |
|
80.00% |
4 / 5 |
CRAP | |
0.00% |
0 / 1 |
| ComposedNick | |
100.00% |
8 / 8 |
|
90.91% |
10 / 11 |
|
50.00% |
5 / 10 |
|
100.00% |
5 / 5 |
10.50 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getTargetGender | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getTargetOffenseLevel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getWords | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getFinalLabel | |
100.00% |
4 / 4 |
|
85.71% |
6 / 7 |
|
16.67% |
1 / 6 |
|
100.00% |
1 / 1 |
4.31 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Dto\Result; |
| 4 | |
| 5 | use App\Enum\OffenseLevel; |
| 6 | use App\Enum\WordGender; |
| 7 | |
| 8 | /** |
| 9 | * @author Wilhelm Zwertvaegher |
| 10 | */ |
| 11 | readonly class ComposedNick |
| 12 | { |
| 13 | /** |
| 14 | * @param list<FormattedNickWord> $words |
| 15 | */ |
| 16 | public function __construct( |
| 17 | private WordGender $targetGender, |
| 18 | private OffenseLevel $targetOffenseLevel, |
| 19 | private array $words, |
| 20 | ) { |
| 21 | } |
| 22 | |
| 23 | public function getTargetGender(): WordGender |
| 24 | { |
| 25 | return $this->targetGender; |
| 26 | } |
| 27 | |
| 28 | public function getTargetOffenseLevel(): OffenseLevel |
| 29 | { |
| 30 | return $this->targetOffenseLevel; |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * @return list<FormattedNickWord> |
| 35 | */ |
| 36 | public function getWords(): array |
| 37 | { |
| 38 | return $this->words; |
| 39 | } |
| 40 | |
| 41 | public function getFinalLabel(): string |
| 42 | { |
| 43 | $finalLabel = ''; |
| 44 | foreach ($this->words as $resultWord) { |
| 45 | $finalLabel .= $resultWord->label.$resultWord->separatorAfter; |
| 46 | } |
| 47 | |
| 48 | return trim($finalLabel); |
| 49 | } |
| 50 | } |