| Total Complexity | 12 |
| Total Lines | 67 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class Update |
||
| 8 | { |
||
| 9 | private $_datos; |
||
| 10 | private $_where; |
||
| 11 | |||
| 12 | 8 | public function __construct(array $datos, WhereInterface $whereInterface) |
|
| 13 | { |
||
| 14 | 8 | $this->_datos = $this->setDatos($datos); |
|
| 15 | 6 | $this->_where = $whereInterface; |
|
| 16 | 6 | } |
|
| 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 | 8 | private function setDatos(array $array): array |
|
| 41 | } |
||
| 42 | |||
| 43 | 8 | private function estaVacio(array $array): void |
|
| 48 | } |
||
| 49 | 7 | } |
|
| 50 | |||
| 51 | 7 | private function columnaVacia(array $array): void |
|
| 52 | { |
||
| 53 | 7 | foreach ($array as $key => $value) |
|
| 54 | { |
||
| 55 | 7 | if(empty($key)) |
|
| 56 | { |
||
| 57 | 1 | throw new Exception("Error Processing Request"); |
|
| 58 | } |
||
| 59 | } |
||
| 60 | 6 | } |
|
| 61 | |||
| 62 | 3 | private function armarConsulta(array $array): string |
|
| 74 | } |
||
| 75 | } |