@@ -20,6 +20,6 @@ |
||
20 | 20 | |
21 | 21 | public function datos(): array |
22 | 22 | { |
23 | - return [ $this->_where[1], $this->_where[2] ]; |
|
23 | + return [$this->_where[1], $this->_where[2]]; |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -20,6 +20,6 @@ |
||
20 | 20 | |
21 | 21 | public function datos(): array |
22 | 22 | { |
23 | - return [ $this->_where[2], $this->_where[5] ]; |
|
23 | + return [$this->_where[2], $this->_where[5]]; |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | { |
20 | 20 | $query = $this->_conexion->prepare($sentencia->sql()); |
21 | 21 | |
22 | - $x=1; |
|
22 | + $x = 1; |
|
23 | 23 | foreach ($sentencia->datos() as $value) |
24 | 24 | { |
25 | - $query->bindValue($x,$value); |
|
25 | + $query->bindValue($x, $value); |
|
26 | 26 | $x++; |
27 | 27 | } |
28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | $query->execute(); |
32 | 32 | } |
33 | - catch(PDOException $e) |
|
33 | + catch (PDOException $e) |
|
34 | 34 | { |
35 | 35 | throw new Exception("Error en la consulta"); |
36 | 36 | } |
@@ -29,8 +29,7 @@ |
||
29 | 29 | try |
30 | 30 | { |
31 | 31 | $query->execute(); |
32 | - } |
|
33 | - catch(PDOException $e) |
|
32 | + } catch(PDOException $e) |
|
34 | 33 | { |
35 | 34 | throw new Exception("Error en la consulta"); |
36 | 35 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | { |
24 | 24 | $query->execute(); |
25 | 25 | } |
26 | - catch(PDOException $e) |
|
26 | + catch (PDOException $e) |
|
27 | 27 | { |
28 | 28 | throw new Exception("Error en la consulta"); |
29 | 29 | } |
@@ -29,8 +29,7 @@ |
||
29 | 29 | try |
30 | 30 | { |
31 | 31 | $query->execute(); |
32 | - } |
|
33 | - catch(PDOException $e) |
|
32 | + } catch(PDOException $e) |
|
34 | 33 | { |
35 | 34 | throw new Exception("Error en la consulta"); |
36 | 35 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | public function testCamposSoloRetornaTexto() |
48 | 48 | { |
49 | - $campos = new Campos(['*','78']); |
|
49 | + $campos = new Campos(['*', '78']); |
|
50 | 50 | $this->assertIsString($campos->sql()); |
51 | 51 | } |
52 | 52 | |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | $tabla = new Tabla('prueba'); |
58 | 58 | $campos = new Campos(['a,b,c,d']); |
59 | 59 | |
60 | - $camposytabla = new CamposYTabla($campos,$tabla); |
|
60 | + $camposytabla = new CamposYTabla($campos, $tabla); |
|
61 | 61 | |
62 | - $this->assertSame('a,b,c,d FROM prueba',$camposytabla->sql()); |
|
62 | + $this->assertSame('a,b,c,d FROM prueba', $camposytabla->sql()); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | //Clase ValidadorDeParametrosWhere |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | public function testValidadorDeParametrosWhereLaColumnaSoloPuedeSerString() |
74 | 74 | { |
75 | 75 | $this->expectException(Exception::class); |
76 | - new ValidadorDeParametrosWhere([1,'1','2']); |
|
76 | + new ValidadorDeParametrosWhere([1, '1', '2']); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | public function testValidadorDeParametrosWhereNingunCampoPuedeEstarVacio() |
80 | 80 | { |
81 | 81 | $this->expectException(Exception::class); |
82 | - new ValidadorDeParametrosWhere(['','1','2']); |
|
82 | + new ValidadorDeParametrosWhere(['', '1', '2']); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | //Clase ValidadorDeParametrosWhereBetween |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | public function testValidadorDeParametrosWhereBetweenNoPuedeTenerValoresIguales() |
94 | 94 | { |
95 | 95 | $this->expectException(Exception::class); |
96 | - new ValidadorDeParametrosWhereBetween(['id','1','1']); |
|
96 | + new ValidadorDeParametrosWhereBetween(['id', '1', '1']); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | public function testValidadorDeParametrosWhereBetweenLaColumnaSoloPuedeSerString() |
100 | 100 | { |
101 | 101 | $this->expectException(Exception::class); |
102 | - new ValidadorDeParametrosWhereBetween([1,'1','2']); |
|
102 | + new ValidadorDeParametrosWhereBetween([1, '1', '2']); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | public function testValidadorDeParametrosWhereBetweenNingunCampoPuedeEstarVacio() |
106 | 106 | { |
107 | 107 | $this->expectException(Exception::class); |
108 | - new ValidadorDeParametrosWhereBetween(['','1','2']); |
|
108 | + new ValidadorDeParametrosWhereBetween(['', '1', '2']); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | //Clase Where |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | { |
115 | 115 | $where = new Where( |
116 | 116 | new ValidadorDeParametrosWhere( |
117 | - ['id','=','21'] |
|
117 | + ['id', '=', '21'] |
|
118 | 118 | ) |
119 | 119 | ); |
120 | 120 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | $where = new Where( |
127 | 127 | new ValidadorDeParametrosWhere( |
128 | - ['id','=','21'] |
|
128 | + ['id', '=', '21'] |
|
129 | 129 | ) |
130 | 130 | ); |
131 | 131 | |
@@ -143,13 +143,13 @@ discard block |
||
143 | 143 | public function testValidadorDeParametrosWhereAndOthersLaColumnaSoloPuedeSerString() |
144 | 144 | { |
145 | 145 | $this->expectException(Exception::class); |
146 | - new ValidadorDeParametrosWhereAndOthers([1,'=','2','1','=','2']); |
|
146 | + new ValidadorDeParametrosWhereAndOthers([1, '=', '2', '1', '=', '2']); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | public function testValidadorDeParametrosWhereAndOthersNingunCampoPuedeEstarVacio() |
150 | 150 | { |
151 | 151 | $this->expectException(Exception::class); |
152 | - new ValidadorDeParametrosWhereAndOthers(['','1','2','','','']); |
|
152 | + new ValidadorDeParametrosWhereAndOthers(['', '1', '2', '', '', '']); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | //Clase Where And |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | { |
159 | 159 | $where = new WhereAnd( |
160 | 160 | new ValidadorDeParametrosWhereAndOthers( |
161 | - ['id','=','21','uno','=','1'] |
|
161 | + ['id', '=', '21', 'uno', '=', '1'] |
|
162 | 162 | ) |
163 | 163 | ); |
164 | 164 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | { |
172 | 172 | $where = new WhereOr( |
173 | 173 | new ValidadorDeParametrosWhereAndOthers( |
174 | - ['id','=','21','uno','=','1'] |
|
174 | + ['id', '=', '21', 'uno', '=', '1'] |
|
175 | 175 | ) |
176 | 176 | ); |
177 | 177 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | { |
185 | 185 | $where = new WhereBetween( |
186 | 186 | new ValidadorDeParametrosWhereBetween( |
187 | - ['id','1','21'] |
|
187 | + ['id', '1', '21'] |
|
188 | 188 | ) |
189 | 189 | ); |
190 | 190 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | $where = new WhereNotBetween( |
199 | 199 | new ValidadorDeParametrosWhereBetween( |
200 | - ['id','1','21'] |
|
200 | + ['id', '1', '21'] |
|
201 | 201 | ) |
202 | 202 | ); |
203 | 203 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | { |
211 | 211 | $where = new WhereNotBetween( |
212 | 212 | new ValidadorDeParametrosWhereBetween( |
213 | - ['id','1','21'] |
|
213 | + ['id', '1', '21'] |
|
214 | 214 | ) |
215 | 215 | ); |
216 | 216 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $where = new WhereNotBetween( |
229 | 229 | new ValidadorDeParametrosWhereBetween( |
230 | - ['id','1','21'] |
|
230 | + ['id', '1', '21'] |
|
231 | 231 | ) |
232 | 232 | ); |
233 | 233 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | new CamposYTabla( |
240 | 240 | new Campos(['*']), |
241 | 241 | new Tabla('prueba') |
242 | - ),$como |
|
242 | + ), $como |
|
243 | 243 | ); |
244 | 244 | |
245 | 245 | $this->assertSame('SELECT * FROM prueba WHERE NOT BETWEEN id ? AND ?', $sentencia->sql()); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | foreach ($array as $value) |
48 | 48 | { |
49 | - if(empty($value)) |
|
49 | + if (empty($value)) |
|
50 | 50 | { |
51 | 51 | throw new Exception("Error Processing Request"); |
52 | 52 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | private function columnasSonString($array): void |
57 | 57 | { |
58 | - if(!is_string($array[0]) || !is_string($array[3])) |
|
58 | + if (!is_string($array[0]) || !is_string($array[3])) |
|
59 | 59 | { |
60 | 60 | throw new Exception("Error Processing Request"); |
61 | 61 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | private function numeroDeElementosValido($array): void |
65 | 65 | { |
66 | - if(count($array) !== 6) |
|
66 | + if (count($array) !== 6) |
|
67 | 67 | { |
68 | 68 | throw new Exception("Error Processing Request"); |
69 | 69 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | private function operadorValido($array): void |
73 | 73 | { |
74 | - if(!in_array($array[1], $this->_operadoresValidos) || !in_array($array[4], $this->_operadoresValidos)) |
|
74 | + if (!in_array($array[1], $this->_operadoresValidos) || !in_array($array[4], $this->_operadoresValidos)) |
|
75 | 75 | { |
76 | 76 | throw new Exception("Error Processing Request"); |
77 | 77 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | declare(strict_types=1); |
3 | 3 | phpinfo(); |
4 | 4 | die(); |
5 | -require_once __DIR__ . '/vendor/autoload.php'; |
|
5 | +require_once __DIR__.'/vendor/autoload.php'; |
|
6 | 6 | |
7 | 7 | use src\Factory; |
8 | 8 | use src\pdodatabase\resultados\ContarResultados; |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | |
17 | 17 | // SELECT * FROM prueba |
18 | 18 | |
19 | -$select = $factory->crear('src\factory\SelectWhere',[ |
|
19 | +$select = $factory->crear('src\factory\SelectWhere', [ |
|
20 | 20 | 'tabla' => 'prueba', |
21 | 21 | 'campos' => ['*'], |
22 | - 'where' => ['id','=','42'] |
|
22 | + 'where' => ['id', '=', '42'] |
|
23 | 23 | ]); |
24 | 24 | |
25 | 25 | $select = $select->obtener(); |