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

Author::booksCount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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