@@ -19,7 +19,7 @@  | 
                                                    ||
| 19 | 19 | |
| 20 | 20 | private function setHostBaseDeDatos(string $nombreHostBaseDeDatos): string  | 
                                                        
| 21 | 21 |      { | 
                                                        
| 22 | - if(empty($nombreHostBaseDeDatos))  | 
                                                        |
| 22 | + if (empty($nombreHostBaseDeDatos))  | 
                                                        |
| 23 | 23 |          { | 
                                                        
| 24 | 24 |              throw new Exception("El nombre del host de la base de datos no puede estar vacio"); | 
                                                        
| 25 | 25 | }  | 
                                                        
@@ -19,7 +19,7 @@  | 
                                                    ||
| 19 | 19 | |
| 20 | 20 | private function setUsuarioBaseDeDatos(string $nombreUsuarioBaseDeDatos): string  | 
                                                        
| 21 | 21 |      { | 
                                                        
| 22 | - if(empty($nombreUsuarioBaseDeDatos))  | 
                                                        |
| 22 | + if (empty($nombreUsuarioBaseDeDatos))  | 
                                                        |
| 23 | 23 |          { | 
                                                        
| 24 | 24 |              throw new Exception("El nombre del host de la base de datos no puede estar vacio"); | 
                                                        
| 25 | 25 | }  | 
                                                        
@@ -18,14 +18,14 @@  | 
                                                    ||
| 18 | 18 | )  | 
                                                        
| 19 | 19 |      { | 
                                                        
| 20 | 20 | try  | 
                                                        
| 21 | -		{ | 
                                                        |
| 22 | -			$this->_pdo = new PDO('mysql:host='.$HostBaseDeDatos->hostBaseDeDatos().';dbname='.$BaseDeDatos->baseDeDatos().';chartset=utf8mb4',$UsuarioBaseDeDatos->usuarioBaseDeDatos(),$ContraseñaBaseDeDatos->contraseñaBaseDeDatos()); | 
                                                        |
| 23 | - $this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);  | 
                                                        |
| 24 | - }  | 
                                                        |
| 25 | - catch(PDOException)  | 
                                                        |
| 26 | -		{ | 
                                                        |
| 27 | -			throw new ConexionABaseDeDatosException("Error al conectar con base de datos"); | 
                                                        |
| 28 | - }  | 
                                                        |
| 21 | +        { | 
                                                        |
| 22 | +            $this->_pdo = new PDO('mysql:host='.$HostBaseDeDatos->hostBaseDeDatos().';dbname='.$BaseDeDatos->baseDeDatos().';chartset=utf8mb4',$UsuarioBaseDeDatos->usuarioBaseDeDatos(),$ContraseñaBaseDeDatos->contraseñaBaseDeDatos()); | 
                                                        |
| 23 | + $this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);  | 
                                                        |
| 24 | + }  | 
                                                        |
| 25 | + catch(PDOException)  | 
                                                        |
| 26 | +        { | 
                                                        |
| 27 | +            throw new ConexionABaseDeDatosException("Error al conectar con base de datos"); | 
                                                        |
| 28 | + }  | 
                                                        |
| 29 | 29 | }  | 
                                                        
| 30 | 30 | |
| 31 | 31 | public function conectar(): PDO  | 
                                                        
@@ -9,8 +9,7 @@ discard block  | 
                                                    ||
| 9 | 9 |  { | 
                                                        
| 10 | 10 | private $_pdo;  | 
                                                        
| 11 | 11 | |
| 12 | - public function __construct  | 
                                                        |
| 13 | - (  | 
                                                        |
| 12 | + public function __construct(  | 
                                                        |
| 14 | 13 | HostBaseDeDatos $HostBaseDeDatos,  | 
                                                        
| 15 | 14 | BaseDeDatos $BaseDeDatos,  | 
                                                        
| 16 | 15 | UsuarioBaseDeDatos $UsuarioBaseDeDatos,  | 
                                                        
@@ -19,10 +18,10 @@ discard block  | 
                                                    ||
| 19 | 18 |      { | 
                                                        
| 20 | 19 | try  | 
                                                        
| 21 | 20 |  		{ | 
                                                        
| 22 | -			$this->_pdo = new PDO('mysql:host='.$HostBaseDeDatos->hostBaseDeDatos().';dbname='.$BaseDeDatos->baseDeDatos().';chartset=utf8mb4',$UsuarioBaseDeDatos->usuarioBaseDeDatos(),$ContraseñaBaseDeDatos->contraseñaBaseDeDatos()); | 
                                                        |
| 21 | +			$this->_pdo = new PDO('mysql:host='.$HostBaseDeDatos->hostBaseDeDatos().';dbname='.$BaseDeDatos->baseDeDatos().';chartset=utf8mb4', $UsuarioBaseDeDatos->usuarioBaseDeDatos(), $ContraseñaBaseDeDatos->contraseñaBaseDeDatos()); | 
                                                        |
| 23 | 22 | $this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);  | 
                                                        
| 24 | 23 | }  | 
                                                        
| 25 | - catch(PDOException)  | 
                                                        |
| 24 | + catch (PDOException)  | 
                                                        |
| 26 | 25 |  		{ | 
                                                        
| 27 | 26 |  			throw new ConexionABaseDeDatosException("Error al conectar con base de datos"); | 
                                                        
| 28 | 27 | }  | 
                                                        
@@ -21,8 +21,7 @@  | 
                                                    ||
| 21 | 21 |  		{ | 
                                                        
| 22 | 22 |  			$this->_pdo = new PDO('mysql:host='.$HostBaseDeDatos->hostBaseDeDatos().';dbname='.$BaseDeDatos->baseDeDatos().';chartset=utf8mb4',$UsuarioBaseDeDatos->usuarioBaseDeDatos(),$ContraseñaBaseDeDatos->contraseñaBaseDeDatos()); | 
                                                        
| 23 | 23 | $this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);  | 
                                                        
| 24 | - }  | 
                                                        |
| 25 | - catch(PDOException)  | 
                                                        |
| 24 | + } catch(PDOException)  | 
                                                        |
| 26 | 25 |  		{ | 
                                                        
| 27 | 26 |  			throw new ConexionABaseDeDatosException("Error al conectar con base de datos"); | 
                                                        
| 28 | 27 | }  | 
                                                        
@@ -19,7 +19,7 @@  | 
                                                    ||
| 19 | 19 | |
| 20 | 20 | private function setBaseDeDatos(string $nombreBaseDeDatos): string  | 
                                                        
| 21 | 21 |      { | 
                                                        
| 22 | - if(empty($nombreBaseDeDatos))  | 
                                                        |
| 22 | + if (empty($nombreBaseDeDatos))  | 
                                                        |
| 23 | 23 |          { | 
                                                        
| 24 | 24 |              throw new Exception("El nombre de la base de datos no puede estar vacio"); | 
                                                        
| 25 | 25 | }  | 
                                                        
@@ -31,11 +31,11 @@  | 
                                                    ||
| 31 | 31 | new Campos($array['campos'])  | 
                                                        
| 32 | 32 | ),  | 
                                                        
| 33 | 33 | new Where(  | 
                                                        
| 34 | - new SentenciaDeComparacionColumnaOperadorValor(  | 
                                                        |
| 35 | - new Columna($array['where'][0]),  | 
                                                        |
| 36 | - new Operador($array['where'][1]),  | 
                                                        |
| 37 | - new Valor($array['where'][2])  | 
                                                        |
| 38 | - )  | 
                                                        |
| 34 | + new SentenciaDeComparacionColumnaOperadorValor(  | 
                                                        |
| 35 | + new Columna($array['where'][0]),  | 
                                                        |
| 36 | + new Operador($array['where'][1]),  | 
                                                        |
| 37 | + new Valor($array['where'][2])  | 
                                                        |
| 38 | + )  | 
                                                        |
| 39 | 39 | )  | 
                                                        
| 40 | 40 | )  | 
                                                        
| 41 | 41 | );  | 
                                                        
@@ -17,10 +17,10 @@  | 
                                                    ||
| 17 | 17 |      { | 
                                                        
| 18 | 18 | $query = $this->_conexion->prepare($SentenciaConDatosInterface->sql());  | 
                                                        
| 19 | 19 | |
| 20 | - $x=1;  | 
                                                        |
| 20 | + $x = 1;  | 
                                                        |
| 21 | 21 | foreach ($SentenciaConDatosInterface->datos() as $value)  | 
                                                        
| 22 | 22 |          { | 
                                                        
| 23 | - $query->bindValue($x,$value);  | 
                                                        |
| 23 | + $query->bindValue($x, $value);  | 
                                                        |
| 24 | 24 | $x++;  | 
                                                        
| 25 | 25 | }  | 
                                                        
| 26 | 26 | |
@@ -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  | 
                                                        
@@ -22,7 +22,7 @@ discard block  | 
                                                    ||
| 22 | 22 | $this->camposNoEstaVacio($array);  | 
                                                        
| 23 | 23 | |
| 24 | 24 | $campos = '';  | 
                                                        
| 25 | - foreach($array as $arr)  | 
                                                        |
| 25 | + foreach ($array as $arr)  | 
                                                        |
| 26 | 26 |          { | 
                                                        
| 27 | 27 | $campos = $arr.','.$campos;  | 
                                                        
| 28 | 28 | }  | 
                                                        
@@ -32,14 +32,14 @@ discard block  | 
                                                    ||
| 32 | 32 | |
| 33 | 33 | private function camposNoEstaVacio(array $array): void  | 
                                                        
| 34 | 34 |      { | 
                                                        
| 35 | - if(count($array) == 0)  | 
                                                        |
| 35 | + if (count($array) == 0)  | 
                                                        |
| 36 | 36 |          { | 
                                                        
| 37 | 37 |              throw new Exception("Error Processing Request");   | 
                                                        
| 38 | 38 | }  | 
                                                        
| 39 | 39 | |
| 40 | 40 | foreach ($array as $value)  | 
                                                        
| 41 | 41 |          { | 
                                                        
| 42 | - if(empty($value))  | 
                                                        |
| 42 | + if (empty($value))  | 
                                                        |
| 43 | 43 |              { | 
                                                        
| 44 | 44 |                  throw new Exception("Error Processing Request"); | 
                                                        
| 45 | 45 | }  | 
                                                        
@@ -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 numeroDeElementosValido($array): void  | 
                                                        
| 57 | 57 |      { | 
                                                        
| 58 | - if(count($array) !== 3)  | 
                                                        |
| 58 | + if (count($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 operadorValido($array): void  | 
                                                        
| 65 | 65 |      { | 
                                                        
| 66 | - if(!in_array($array[1], $this->_operadoresValidos))  | 
                                                        |
| 66 | + if (!in_array($array[1], $this->_operadoresValidos))  | 
                                                        |
| 67 | 67 |          { | 
                                                        
| 68 | 68 |              throw new Exception("Error Processing Request"); | 
                                                        
| 69 | 69 | }  | 
                                                        
@@ -71,7 +71,7 @@ discard block  | 
                                                    ||
| 71 | 71 | |
| 72 | 72 | private function columnaEsString($array): void  | 
                                                        
| 73 | 73 |      { | 
                                                        
| 74 | - if(!is_string($array[0]))  | 
                                                        |
| 74 | + if (!is_string($array[0]))  | 
                                                        |
| 75 | 75 |          { | 
                                                        
| 76 | 76 |              throw new Exception("Error Processing Request"); | 
                                                        
| 77 | 77 | }  |