TipoDePersonal::tipoDePersonal()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
namespace src;
3
4
use Exception;
5
6
class TipoDePersonal
7
{
8
    private string $_tipoDePersonal;
9
10
    public function __construct(string $tipoDePersonal)
11
    {
12
        $this->_tipoDePersonal = $this->setTipoDePersonal($tipoDePersonal);
13
    }
14
15
    public function tipoDePersonal(): string
16
    {
17
        return $this->_tipoDePersonal;
18
    }
19
20
    private function setTipoDePersonal(string $tipoDePersonal): string
21
    {
22
        if(
23
            $tipoDePersonal == 'Sindicalizado' || 
24
            $tipoDePersonal == 'Confianza' ||
25
            $tipoDePersonal == 'Ninguno'
26
        )
27
        {
28
            return $tipoDePersonal;
29
        }
30
31
        throw new Exception("Error en Tipo de Personal", 1);  
32
    }
33
}