Passed
Push — main ( 6ff268...46b174 )
by Osvaldo
01:43
created

Entre::alfaNumerico()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
namespace src\pdodatabase\elementos;
3
4
use Exception;
5
6
class Entre
7
{
8
    private $_entre;
9
    private $_datos;
10
11
    public function __construct(array $Entre)
12
    {
13
        $this->_entre = $this->setEntre($Entre);
14
    }
15
16
    public function donde(): string
17
    {
18
        return $this->_entre;
19
    }
20
21
    public function datos(): array
22
    {
23
        return $this->_datos;
24
    }
25
26
    private function setEntre(array $columnas): string
27
    {
28
        if(count($columnas) !== 3)
29
        {
30
            throw new Exception("Faltan elementos en la sentencia BETWEEN");   
31
        }
32
33
        $this->_datos = $this->setDatos($columnas);
34
        
35
        return ' WHERE '.$columnas[0].' BETWEEN ? AND ?';
36
    }
37
38
    private function setDatos(array $columnas): array
39
    {
40
        return array($columnas[1],$columnas[2]);
41
    }
42
}