@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | private function setTabla(string $tabla): string |
20 | 20 | { |
21 | - if(strlen($tabla) < 1) |
|
21 | + if (strlen($tabla) < 1) |
|
22 | 22 | { |
23 | 23 | throw new Exception("La tabla no puede estar vacia"); |
24 | 24 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | public function insert(): string |
22 | - { |
|
22 | + { |
|
23 | 23 | $keys = array_keys($this->_valoresAInsertar->valoresAInsertar()); |
24 | 24 | $values = ''; |
25 | 25 | |
@@ -37,5 +37,5 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | return "INSERT INTO ". $this->_tabla->tabla()." (`". implode('`, `', $keys) ."`) VALUES ({$values})"; |
40 | - } |
|
40 | + } |
|
41 | 41 | } |
42 | 42 | \ No newline at end of file |
@@ -8,8 +8,7 @@ discard block |
||
8 | 8 | private $_tabla; |
9 | 9 | private $_valoresAInsertar; |
10 | 10 | |
11 | - public function __construct |
|
12 | - ( |
|
11 | + public function __construct( |
|
13 | 12 | Tabla $Tabla, |
14 | 13 | ValoresAInsertar $ValoresAInsertar |
15 | 14 | ) |
@@ -23,19 +22,19 @@ discard block |
||
23 | 22 | $keys = array_keys($this->_valoresAInsertar->valoresAInsertar()); |
24 | 23 | $values = ''; |
25 | 24 | |
26 | - $x=1; |
|
27 | - foreach($this->_valoresAInsertar->valoresAInsertar() as $field) |
|
25 | + $x = 1; |
|
26 | + foreach ($this->_valoresAInsertar->valoresAInsertar() as $field) |
|
28 | 27 | { |
29 | - $values.= "?"; |
|
28 | + $values .= "?"; |
|
30 | 29 | |
31 | - if($x < count($this->_valoresAInsertar->valoresAInsertar())) |
|
30 | + if ($x < count($this->_valoresAInsertar->valoresAInsertar())) |
|
32 | 31 | { |
33 | - $values.= ', '; |
|
32 | + $values .= ', '; |
|
34 | 33 | } |
35 | 34 | |
36 | 35 | $x++; |
37 | 36 | } |
38 | 37 | |
39 | - return "INSERT INTO ". $this->_tabla->tabla()." (`". implode('`, `', $keys) ."`) VALUES ({$values})"; |
|
38 | + return "INSERT INTO ".$this->_tabla->tabla()." (`".implode('`, `', $keys)."`) VALUES ({$values})"; |
|
40 | 39 | } |
41 | 40 | } |
42 | 41 | \ No newline at end of file |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | private function setValoresAInsertar(array $array): array |
21 | 21 | { |
22 | - if(count($array) < 1) |
|
22 | + if (count($array) < 1) |
|
23 | 23 | { |
24 | 24 | throw new Exception("Error, no hay valores para insertar"); |
25 | 25 | } |