UserArrayDataTransformer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 9
c 1
b 0
f 0
dl 0
loc 21
ccs 0
cts 12
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A read() 0 7 1
A write() 0 5 1
1
<?php
2
3
namespace ProyectoTAU\TAU\Module\Administration\User\Application\DataTransformer;
4
5
use ProyectoTAU\TAU\Module\Administration\User\Domain\User;
6
7
class UserArrayDataTransformer implements DataTransformer
8
{
9
    /**
10
     * @var User
11
     */
12
    private $user;
13
14
    public function write(User $user)
15
    {
16
        $this->user = $user;
17
18
        return $this;
19
    }
20
21
    public function read()
22
    {
23
        return [
24
            'id'    => $this->user->getId(),
25
            'name'  => $this->user->getName(),
26
            'surname' => $this->user->getSurname(),
27
            'login' => $this->user->getLogin(),
28
        ];
29
    }
30
}
31
{
32
33
}
34