Total Complexity | 5 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
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 | } |
||
39 |