SesionId::estaVacio()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 2
b 0
f 0
nc 2
nop 1
dl 0
loc 4
rs 10
1
<?php
2
namespace src;
3
4
use Exception;
5
6
class SesionId
7
{
8
    private string $_id;
9
10
    public function __construct(string $id)
11
    {
12
        $this->_id = $this->setId($id);
13
    }
14
15
    public function id(): string
16
    {
17
        return $this->_id;
18
    }
19
20
    private function setId(string $string): string
21
    {
22
        $this->estaVacio($string);
23
24
        return $string;
25
    }
26
27
    private function estaVacio(string $string): void
28
    {
29
        if (empty($string)) {
30
            throw new Exception("El ID de sesión no puede estar vacío");
31
        }
32
    }
33
}
34