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

Author   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Domain\Model;
6
7
class Author
8
{
9
    private $id;
10
    private $fullName;
11
    private $booksCount = 0;
12
13
    public function __construct(AuthorId $id, string $fullName)
14
    {
15
        $this->id = (string) $id;
16
        $this->fullName = $fullName;
17
    }
18
19
    public function id(): AuthorId
20
    {
21
        return AuthorId::fromString((string) $this->id);
22
    }
23
24
    public function fullName(): string
25
    {
26
        return $this->fullName;
27
    }
28
29
    public function booksCount(): int
30
    {
31
        return $this->booksCount;
32
    }
33
34
    public function incrementBooksCount(): void
35
    {
36
        ++$this->booksCount;
37
    }
38
}
39