Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
8 / 8
CRAP
100.00% covered (success)
100.00%
1 / 1
Book
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
8 / 8
8
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getTitle
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getAuthor
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getIsbn
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getStatus
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 markAsBorrowed
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 markAsAvailable
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3// ╔════════════════════════════════════════════════════════════╗
4// ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║
5// ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com>     ║
6// ╚════════════════════════════════════════════════════════════╝
7
8declare(strict_types=1);
9
10namespace AppDemo\Library\Domain;
11
12use Phexium\Domain\EntityAbstract;
13use Phexium\Domain\EntityInterface;
14use Phexium\Domain\Id\IdInterface;
15
16class Book extends EntityAbstract implements EntityInterface
17{
18    public function __construct(
19        private readonly IdInterface $id,
20        private readonly Title $title,
21        private readonly Author $author,
22        private readonly ISBN $isbn,
23        private BookStatus $status = BookStatus::Available
24    ) {}
25
26    public function getId(): IdInterface
27    {
28        return $this->id;
29    }
30
31    public function getTitle(): Title
32    {
33        return $this->title;
34    }
35
36    public function getAuthor(): Author
37    {
38        return $this->author;
39    }
40
41    public function getIsbn(): ISBN
42    {
43        return $this->isbn;
44    }
45
46    public function getStatus(): BookStatus
47    {
48        return $this->status;
49    }
50
51    public function markAsBorrowed(): void
52    {
53        $this->status = BookStatus::Borrowed;
54    }
55
56    public function markAsAvailable(): void
57    {
58        $this->status = BookStatus::Available;
59    }
60}