Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
80.00% covered (warning)
80.00%
4 / 5
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
Papel
80.00% covered (warning)
80.00%
4 / 5
50.00% covered (danger)
50.00%
1 / 2
3.07
0.00% covered (danger)
0.00%
0 / 1
 __construct
75.00% covered (warning)
75.00%
3 / 4
0.00% covered (danger)
0.00%
0 / 1
2.06
 get
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Core\Models;
4
5class Papel
6{
7    public static string $ADMIN = 'admin';
8    public static string $COLABORADOR = 'colaborador';
9    public static string $MEMBRO = 'membro';
10
11    public function __construct(
12        public string $papel,
13    ) {
14        if(!in_array(
15            $papel, [self::$ADMIN, self::$COLABORADOR, self::$MEMBRO]
16        )) {
17            throw new ValidationException("Papel inválido", $papel);
18        }
19    }
20
21    public function get()
22    {
23        return $this->papel;
24    }
25}