Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
Livro
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
5 / 5
5
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
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
 ativar
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 inativar
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getAtivo
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Core\Models;
4
5use Core\Models\{
6    Autor
7};
8
9class Livro
10{
11    protected bool $ativo;
12    public \DateTimeImmutable   $created_at;
13    public \DateTime            $updated_at;
14
15    public function __construct(
16        private     ?int    $id = null,
17        public      string  $titulo,
18        public      Autor   $autor,
19        public      int     $quantidade,
20    ) {
21        $this->ativo = true;
22    }
23
24    public function getId() {
25        return $this->id;
26    }
27
28    public function ativar() {
29        $this->ativo = true;
30        return $this;
31    }
32
33    public function inativar() {
34        $this->ativo = false;
35        return $this;
36    }
37
38    public function getAtivo() {
39        return $this->ativo;
40    }
41}
42