Rol   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 25
ccs 11
cts 11
cp 1
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setRol() 0 5 1
A __construct() 0 3 1
A rol() 0 3 1
A estaVacio() 0 4 2
1
<?php
2
namespace src;
3
4
use src\excepciones\ElRolNoPuedeEstarVacioException;
5
6
class Rol
7
{
8
    private string $_rol;
9
10 14
    public function __construct(string $rol)
11
    {
12 14
        $this->_rol = $this->setRol($rol);
13 14
    }
14
15 14
    public function rol(): string
16
    {
17 14
        return $this->_rol;
18
    }
19
20 14
    private function setRol(string $string): string
21
    {
22 14
        $this->estaVacio($string);
23
24 14
        return $string;
25
    }
26
27 14
    private function estaVacio(string $rol): void
28
    {
29 14
        if (empty($rol)) {
30 1
            throw new ElRolNoPuedeEstarVacioException("El Rol no puede estar vacío");
31
        }
32 14
    }
33
}
34