Completed
Push — master ( 685a37...c037a4 )
by Nil
04:54
created

UserAdapter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 16
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromEloquent() 0 8 1
1
<?php
2
3
namespace NilPortugues\Example\Service;
4
5
use DateTimeImmutable;
6
use NilPortugues\Example\Domain\User;
7
use NilPortugues\Example\Domain\UserId;
8
9
class UserAdapter
10
{
11
    /**
12
     * @param $model
13
     *
14
     * @return User
15
     */
16
    public function fromEloquent($model)
17
    {
18
        return new User(
19
            new UserId($model->id),
20
            $model->name,
21
            new DateTimeImmutable($model->created_at)
22
        );
23
    }
24
}
25