Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
6 / 6 |
CRAP | |
100.00% |
1 / 1 |
| Usuario | |
100.00% |
9 / 9 |
|
100.00% |
6 / 6 |
6 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getSenha | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| ativar | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| inativar | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getAtivo | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Core\Models; |
| 4 | |
| 5 | use Core\Models\{ |
| 6 | Email, |
| 7 | CPF, |
| 8 | Papel, |
| 9 | }; |
| 10 | |
| 11 | class Usuario |
| 12 | { |
| 13 | protected bool $ativo; |
| 14 | public \DateTimeImmutable $created_at; |
| 15 | public \DateTime $updated_at; |
| 16 | |
| 17 | public function __construct( |
| 18 | private ?int $id = null, |
| 19 | public string $nome, |
| 20 | public CPF $cpf, |
| 21 | private string $senha, // criptografada |
| 22 | public Email $email, |
| 23 | public Papel $papel, |
| 24 | ) { |
| 25 | $this->ativo = true; |
| 26 | } |
| 27 | |
| 28 | public function getId() { |
| 29 | return $this->id; |
| 30 | } |
| 31 | |
| 32 | public function getSenha() { |
| 33 | return $this->senha; |
| 34 | } |
| 35 | |
| 36 | public function ativar() { |
| 37 | $this->ativo = true; |
| 38 | return $this; |
| 39 | } |
| 40 | |
| 41 | public function inativar() { |
| 42 | $this->ativo = false; |
| 43 | return $this; |
| 44 | } |
| 45 | |
| 46 | public function getAtivo() { |
| 47 | return $this->ativo; |
| 48 | } |
| 49 | } |