Passed
Push — master ( a55f22...56813c )
by Paweł
02:35
created

NormalizePlayer::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 15
ccs 0
cts 11
cp 0
crap 2
rs 9.8666
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AardsGerds\Game\Infrastructure\Persistence;
6
7
use AardsGerds\Game\Player\Player;
8
9
final class NormalizePlayer
10
{
11
    public function __invoke(Player $player): array
12
    {
13
        return [
14
            'name' => $player->getName(),
15
            'health' => $player->getHealth()->get(),
16
            'etherum' => $player->getEtherum()->get(),
17
            'strength' => $player->getStrength()->get(),
18
            'talents' => 'not implemented yet',
19
            'weapon' => 'not implemented yet',
20
            'levelProgress' => [
21
                'level' => $player->getLevelProgress()->getLevel()->get(),
22
                'currentExperience' => $player->getLevelProgress()->getCurrentExperience()->get(),
23
            ],
24
            'attributePoints' => $player->getAttributePoints()->get(),
25
            'talentPoints' => $player->getTalentPoints()->get(),
26
        ];
27
    }
28
}
29