Passed
Push — master ( 75052b...8ecf83 )
by Dmitri
01:50
created

Assembler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Application\Dto;
6
7
use App\Domain\Model\Author;
8
use App\Domain\Model\Book;
9
10
final class Assembler
11
{
12
    public function toBookDto(Book $book): BookDto
13
    {
14
        $dto = new BookDto();
15
16
        $dto->id = (string) $book->id();
17
        $dto->authorId = (string) $book->authorId();
18
        $dto->title = $book->title();
19
        $dto->createdAt = $book->createdAt();
20
21
        return $dto;
22
    }
23
24
    public function toAuthorDto(Author $author): AuthorDto
25
    {
26
        $dto = new AuthorDto();
27
28
        $dto->id = (string) $author->id();
29
        $dto->fullName = $author->fullName();
30
        $dto->booksCount = $author->booksCount();
31
32
        return $dto;
33
    }
34
}
35