Total Complexity | 12 |
Total Lines | 67 |
Duplicated Lines | 0 % |
Coverage | 96.67% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class Update |
||
8 | { |
||
9 | private $_datos; |
||
10 | private $_where; |
||
11 | |||
12 | 6 | public function __construct(array $datos, WhereInterface $whereInterface) |
|
13 | { |
||
14 | 6 | $this->_datos = $this->setDatos($datos); |
|
15 | 5 | $this->_where = $whereInterface; |
|
16 | 5 | } |
|
17 | |||
18 | 3 | public function sql(): string |
|
19 | { |
||
20 | 3 | return $this->armarConsulta($this->_datos).' '.$this->_where->sql(); |
|
21 | } |
||
22 | |||
23 | 3 | public function datos(): array |
|
24 | { |
||
25 | 3 | $array = $this->_datos; |
|
26 | |||
27 | 3 | foreach ($this->_where->datos() as $value) |
|
28 | { |
||
29 | 3 | array_push($array, $value); |
|
30 | } |
||
31 | |||
32 | 3 | return $array; |
|
33 | } |
||
34 | |||
35 | 6 | private function setDatos(array $array): array |
|
41 | } |
||
42 | |||
43 | 6 | private function estaVacio(array $array): void |
|
44 | { |
||
45 | 6 | if (count($array) == 0) |
|
46 | { |
||
47 | 1 | throw new Exception("Error Processing Request"); |
|
48 | } |
||
49 | 5 | } |
|
50 | |||
51 | 5 | private function columnaVacia(array $array): void |
|
58 | } |
||
59 | } |
||
60 | 5 | } |
|
61 | |||
62 | 3 | private function armarConsulta(array $array): string |
|
74 | } |
||
75 | } |