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

UserAdapter::fromEloquent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 8
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 5
nc 1
nop 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