@@ -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 | } |
@@ -5,25 +5,25 @@ |
||
| 5 | 5 | |
| 6 | 6 | class HostBaseDeDatos |
| 7 | 7 | { |
| 8 | - private $_hostbaseDeDatos; |
|
| 8 | + private $_hostbaseDeDatos; |
|
| 9 | 9 | |
| 10 | - public function __construct(string $nombreHostBaseDeDatos) |
|
| 11 | - { |
|
| 12 | - $this->_hostbaseDeDatos = $this->setHostBaseDeDatos($nombreHostBaseDeDatos); |
|
| 13 | - } |
|
| 10 | + public function __construct(string $nombreHostBaseDeDatos) |
|
| 11 | + { |
|
| 12 | + $this->_hostbaseDeDatos = $this->setHostBaseDeDatos($nombreHostBaseDeDatos); |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | - public function hostbaseDeDatos(): string |
|
| 16 | - { |
|
| 17 | - return $this->_hostbaseDeDatos; |
|
| 18 | - } |
|
| 15 | + public function hostbaseDeDatos(): string |
|
| 16 | + { |
|
| 17 | + return $this->_hostbaseDeDatos; |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - private function setHostBaseDeDatos(string $nombreHostBaseDeDatos): string |
|
| 21 | - { |
|
| 22 | - if(empty($nombreHostBaseDeDatos)) |
|
| 23 | - { |
|
| 24 | - throw new Exception("El nombre del host de la base de datos no puede estar vacio"); |
|
| 25 | - } |
|
| 20 | + private function setHostBaseDeDatos(string $nombreHostBaseDeDatos): string |
|
| 21 | + { |
|
| 22 | + if(empty($nombreHostBaseDeDatos)) |
|
| 23 | + { |
|
| 24 | + throw new Exception("El nombre del host de la base de datos no puede estar vacio"); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - return $nombreHostBaseDeDatos; |
|
| 28 | - } |
|
| 27 | + return $nombreHostBaseDeDatos; |
|
| 28 | + } |
|
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -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 | } |
@@ -5,25 +5,25 @@ |
||
| 5 | 5 | |
| 6 | 6 | class UsuarioBaseDeDatos |
| 7 | 7 | { |
| 8 | - private $_usuariobaseDeDatos; |
|
| 8 | + private $_usuariobaseDeDatos; |
|
| 9 | 9 | |
| 10 | - public function __construct(string $nombreUsuarioBaseDeDatos) |
|
| 11 | - { |
|
| 12 | - $this->_usuariobaseDeDatos = $this->setUsuarioBaseDeDatos($nombreUsuarioBaseDeDatos); |
|
| 13 | - } |
|
| 10 | + public function __construct(string $nombreUsuarioBaseDeDatos) |
|
| 11 | + { |
|
| 12 | + $this->_usuariobaseDeDatos = $this->setUsuarioBaseDeDatos($nombreUsuarioBaseDeDatos); |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | - public function usuariobaseDeDatos(): string |
|
| 16 | - { |
|
| 17 | - return $this->_usuariobaseDeDatos; |
|
| 18 | - } |
|
| 15 | + public function usuariobaseDeDatos(): string |
|
| 16 | + { |
|
| 17 | + return $this->_usuariobaseDeDatos; |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - private function setUsuarioBaseDeDatos(string $nombreUsuarioBaseDeDatos): string |
|
| 21 | - { |
|
| 22 | - if(empty($nombreUsuarioBaseDeDatos)) |
|
| 23 | - { |
|
| 24 | - throw new Exception("El nombre del host de la base de datos no puede estar vacio"); |
|
| 25 | - } |
|
| 20 | + private function setUsuarioBaseDeDatos(string $nombreUsuarioBaseDeDatos): string |
|
| 21 | + { |
|
| 22 | + if(empty($nombreUsuarioBaseDeDatos)) |
|
| 23 | + { |
|
| 24 | + throw new Exception("El nombre del host de la base de datos no puede estar vacio"); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - return $nombreUsuarioBaseDeDatos; |
|
| 28 | - } |
|
| 27 | + return $nombreUsuarioBaseDeDatos; |
|
| 28 | + } |
|
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -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 | } |
@@ -7,17 +7,17 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | class ConexionBaseDeDatos |
| 9 | 9 | { |
| 10 | - private $_pdo; |
|
| 10 | + private $_pdo; |
|
| 11 | 11 | |
| 12 | - public function __construct |
|
| 13 | - ( |
|
| 14 | - HostBaseDeDatos $HostBaseDeDatos, |
|
| 15 | - BaseDeDatos $BaseDeDatos, |
|
| 16 | - UsuarioBaseDeDatos $UsuarioBaseDeDatos, |
|
| 17 | - ContraseñaBaseDeDatos $ContraseñaBaseDeDatos |
|
| 18 | - ) |
|
| 19 | - { |
|
| 20 | - try |
|
| 12 | + public function __construct |
|
| 13 | + ( |
|
| 14 | + HostBaseDeDatos $HostBaseDeDatos, |
|
| 15 | + BaseDeDatos $BaseDeDatos, |
|
| 16 | + UsuarioBaseDeDatos $UsuarioBaseDeDatos, |
|
| 17 | + ContraseñaBaseDeDatos $ContraseñaBaseDeDatos |
|
| 18 | + ) |
|
| 19 | + { |
|
| 20 | + try |
|
| 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); |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | throw new ConexionABaseDeDatosException("Error al conectar con base de datos"); |
| 28 | 28 | } |
| 29 | - } |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - public function conectar(): PDO |
|
| 32 | - { |
|
| 33 | - return $this->_pdo; |
|
| 34 | - } |
|
| 31 | + public function conectar(): PDO |
|
| 32 | + { |
|
| 33 | + return $this->_pdo; |
|
| 34 | + } |
|
| 35 | 35 | } |
| 36 | 36 | \ No newline at end of file |
@@ -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 | } |
@@ -5,25 +5,25 @@ |
||
| 5 | 5 | |
| 6 | 6 | class BaseDeDatos |
| 7 | 7 | { |
| 8 | - private $_baseDeDatos; |
|
| 8 | + private $_baseDeDatos; |
|
| 9 | 9 | |
| 10 | - public function __construct(string $nombreBaseDeDatos) |
|
| 11 | - { |
|
| 12 | - $this->_baseDeDatos = $this->setBaseDeDatos($nombreBaseDeDatos); |
|
| 13 | - } |
|
| 10 | + public function __construct(string $nombreBaseDeDatos) |
|
| 11 | + { |
|
| 12 | + $this->_baseDeDatos = $this->setBaseDeDatos($nombreBaseDeDatos); |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | - public function baseDeDatos(): string |
|
| 16 | - { |
|
| 17 | - return $this->_baseDeDatos; |
|
| 18 | - } |
|
| 15 | + public function baseDeDatos(): string |
|
| 16 | + { |
|
| 17 | + return $this->_baseDeDatos; |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - private function setBaseDeDatos(string $nombreBaseDeDatos): string |
|
| 21 | - { |
|
| 22 | - if(empty($nombreBaseDeDatos)) |
|
| 23 | - { |
|
| 24 | - throw new Exception("El nombre de la base de datos no puede estar vacio"); |
|
| 25 | - } |
|
| 20 | + private function setBaseDeDatos(string $nombreBaseDeDatos): string |
|
| 21 | + { |
|
| 22 | + if(empty($nombreBaseDeDatos)) |
|
| 23 | + { |
|
| 24 | + throw new Exception("El nombre de la base de datos no puede estar vacio"); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - return $nombreBaseDeDatos; |
|
| 28 | - } |
|
| 27 | + return $nombreBaseDeDatos; |
|
| 28 | + } |
|
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -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 |
@@ -6,20 +6,20 @@ |
||
| 6 | 6 | |
| 7 | 7 | class WhereNotBetween implements WhereInterface |
| 8 | 8 | { |
| 9 | - private $_where; |
|
| 9 | + private $_where; |
|
| 10 | 10 | |
| 11 | - public function __construct(ValidadorDeParametrosInterface $ValidadorDeParametrosInterface) |
|
| 12 | - { |
|
| 13 | - $this->_where = $ValidadorDeParametrosInterface->datos(); |
|
| 14 | - } |
|
| 11 | + public function __construct(ValidadorDeParametrosInterface $ValidadorDeParametrosInterface) |
|
| 12 | + { |
|
| 13 | + $this->_where = $ValidadorDeParametrosInterface->datos(); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - public function sql(): string |
|
| 17 | - { |
|
| 18 | - return 'WHERE NOT BETWEEN '.$this->_where[0].' ? AND ?'; |
|
| 19 | - } |
|
| 16 | + public function sql(): string |
|
| 17 | + { |
|
| 18 | + return 'WHERE NOT BETWEEN '.$this->_where[0].' ? AND ?'; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - public function datos(): array |
|
| 22 | - { |
|
| 23 | - return [ $this->_where[1], $this->_where[2] ]; |
|
| 24 | - } |
|
| 21 | + public function datos(): array |
|
| 22 | + { |
|
| 23 | + return [ $this->_where[1], $this->_where[2] ]; |
|
| 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 | } |
@@ -5,44 +5,44 @@ |
||
| 5 | 5 | |
| 6 | 6 | class Campos |
| 7 | 7 | { |
| 8 | - private $_campos; |
|
| 9 | - |
|
| 10 | - public function __construct(array $array) |
|
| 11 | - { |
|
| 12 | - $this->_campos = $this->setCampos($array); |
|
| 13 | - } |
|
| 14 | - |
|
| 15 | - public function sql(): string |
|
| 16 | - { |
|
| 17 | - return $this->_campos; |
|
| 18 | - } |
|
| 19 | - |
|
| 20 | - private function setCampos(array $array): string |
|
| 21 | - { |
|
| 22 | - $this->camposNoEstaVacio($array); |
|
| 23 | - |
|
| 24 | - $campos = ''; |
|
| 25 | - foreach($array as $arr) |
|
| 26 | - { |
|
| 27 | - $campos = $arr.','.$campos; |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - return trim($campos, ','); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - private function camposNoEstaVacio(array $array): void |
|
| 34 | - { |
|
| 35 | - if(count($array) == 0) |
|
| 36 | - { |
|
| 37 | - throw new Exception("Error Processing Request"); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - foreach ($array as $value) |
|
| 41 | - { |
|
| 42 | - if(empty($value)) |
|
| 43 | - { |
|
| 44 | - throw new Exception("Error Processing Request"); |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - } |
|
| 8 | + private $_campos; |
|
| 9 | + |
|
| 10 | + public function __construct(array $array) |
|
| 11 | + { |
|
| 12 | + $this->_campos = $this->setCampos($array); |
|
| 13 | + } |
|
| 14 | + |
|
| 15 | + public function sql(): string |
|
| 16 | + { |
|
| 17 | + return $this->_campos; |
|
| 18 | + } |
|
| 19 | + |
|
| 20 | + private function setCampos(array $array): string |
|
| 21 | + { |
|
| 22 | + $this->camposNoEstaVacio($array); |
|
| 23 | + |
|
| 24 | + $campos = ''; |
|
| 25 | + foreach($array as $arr) |
|
| 26 | + { |
|
| 27 | + $campos = $arr.','.$campos; |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + return trim($campos, ','); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + private function camposNoEstaVacio(array $array): void |
|
| 34 | + { |
|
| 35 | + if(count($array) == 0) |
|
| 36 | + { |
|
| 37 | + throw new Exception("Error Processing Request"); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + foreach ($array as $value) |
|
| 41 | + { |
|
| 42 | + if(empty($value)) |
|
| 43 | + { |
|
| 44 | + throw new Exception("Error Processing Request"); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | 48 | } |
| 49 | 49 | \ No newline at end of file |
@@ -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 | } |
@@ -6,74 +6,74 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ValidadorDeParametrosWhere implements ValidadorDeParametrosInterface |
| 8 | 8 | { |
| 9 | - private $_operadoresValidos = [ |
|
| 10 | - '=', |
|
| 11 | - '>', |
|
| 12 | - '<', |
|
| 13 | - '>=', |
|
| 14 | - '<=', |
|
| 15 | - '<>', |
|
| 16 | - '!=', |
|
| 17 | - '!<', |
|
| 18 | - '!>', |
|
| 19 | - 'LIKE', |
|
| 20 | - 'IN', |
|
| 21 | - ]; |
|
| 9 | + private $_operadoresValidos = [ |
|
| 10 | + '=', |
|
| 11 | + '>', |
|
| 12 | + '<', |
|
| 13 | + '>=', |
|
| 14 | + '<=', |
|
| 15 | + '<>', |
|
| 16 | + '!=', |
|
| 17 | + '!<', |
|
| 18 | + '!>', |
|
| 19 | + 'LIKE', |
|
| 20 | + 'IN', |
|
| 21 | + ]; |
|
| 22 | 22 | |
| 23 | - private $_datos; |
|
| 23 | + private $_datos; |
|
| 24 | 24 | |
| 25 | - public function __construct(array $datos) |
|
| 26 | - { |
|
| 27 | - $this->_datos = $this->setDatos($datos); |
|
| 28 | - } |
|
| 25 | + public function __construct(array $datos) |
|
| 26 | + { |
|
| 27 | + $this->_datos = $this->setDatos($datos); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - public function datos(): array |
|
| 31 | - { |
|
| 32 | - return $this->_datos; |
|
| 33 | - } |
|
| 30 | + public function datos(): array |
|
| 31 | + { |
|
| 32 | + return $this->_datos; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - public function setDatos($array): array |
|
| 36 | - { |
|
| 37 | - $this->numeroDeElementosValido($array); |
|
| 38 | - $this->contieneValoresVacios($array); |
|
| 39 | - $this->columnaEsString($array); |
|
| 40 | - $this->operadorValido($array); |
|
| 35 | + public function setDatos($array): array |
|
| 36 | + { |
|
| 37 | + $this->numeroDeElementosValido($array); |
|
| 38 | + $this->contieneValoresVacios($array); |
|
| 39 | + $this->columnaEsString($array); |
|
| 40 | + $this->operadorValido($array); |
|
| 41 | 41 | |
| 42 | - return $array; |
|
| 43 | - } |
|
| 42 | + return $array; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - private function contieneValoresVacios($array): void |
|
| 46 | - { |
|
| 47 | - foreach ($array as $value) |
|
| 48 | - { |
|
| 49 | - if(empty($value)) |
|
| 50 | - { |
|
| 51 | - throw new Exception("Error Processing Request"); |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - } |
|
| 45 | + private function contieneValoresVacios($array): void |
|
| 46 | + { |
|
| 47 | + foreach ($array as $value) |
|
| 48 | + { |
|
| 49 | + if(empty($value)) |
|
| 50 | + { |
|
| 51 | + throw new Exception("Error Processing Request"); |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - private function numeroDeElementosValido($array): void |
|
| 57 | - { |
|
| 58 | - if(count($array) !== 3) |
|
| 59 | - { |
|
| 60 | - throw new Exception("Error Processing Request"); |
|
| 61 | - } |
|
| 62 | - } |
|
| 56 | + private function numeroDeElementosValido($array): void |
|
| 57 | + { |
|
| 58 | + if(count($array) !== 3) |
|
| 59 | + { |
|
| 60 | + throw new Exception("Error Processing Request"); |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - private function operadorValido($array): void |
|
| 65 | - { |
|
| 66 | - if(!in_array($array[1], $this->_operadoresValidos)) |
|
| 67 | - { |
|
| 68 | - throw new Exception("Error Processing Request"); |
|
| 69 | - } |
|
| 70 | - } |
|
| 64 | + private function operadorValido($array): void |
|
| 65 | + { |
|
| 66 | + if(!in_array($array[1], $this->_operadoresValidos)) |
|
| 67 | + { |
|
| 68 | + throw new Exception("Error Processing Request"); |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - private function columnaEsString($array): void |
|
| 73 | - { |
|
| 74 | - if(!is_string($array[0])) |
|
| 75 | - { |
|
| 76 | - throw new Exception("Error Processing Request"); |
|
| 77 | - } |
|
| 78 | - } |
|
| 72 | + private function columnaEsString($array): void |
|
| 73 | + { |
|
| 74 | + if(!is_string($array[0])) |
|
| 75 | + { |
|
| 76 | + throw new Exception("Error Processing Request"); |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | 79 | } |
| 80 | 80 | \ No newline at end of file |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | foreach ($array as $value) |
| 34 | 34 | { |
| 35 | - if(empty($value)) |
|
| 35 | + if (empty($value)) |
|
| 36 | 36 | { |
| 37 | 37 | throw new Exception("Error Processing Request"); |
| 38 | 38 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | private function valoresNoSonIguales($array): void |
| 43 | 43 | { |
| 44 | - if($array[1] == $array[2]) |
|
| 44 | + if ($array[1] == $array[2]) |
|
| 45 | 45 | { |
| 46 | 46 | throw new Exception("Error Processing Request"); |
| 47 | 47 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | private function numeroDeElementosValido($array): void |
| 51 | 51 | { |
| 52 | - if(count($array) !== 3) |
|
| 52 | + if (count($array) !== 3) |
|
| 53 | 53 | { |
| 54 | 54 | throw new Exception("Error Processing Request"); |
| 55 | 55 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | private function columnaEsString($array): void |
| 59 | 59 | { |
| 60 | - if(!is_string($array[0])) |
|
| 60 | + if (!is_string($array[0])) |
|
| 61 | 61 | { |
| 62 | 62 | throw new Exception("Error Processing Request"); |
| 63 | 63 | } |
@@ -6,60 +6,60 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ValidadorDeParametrosWhereBetween implements ValidadorDeParametrosInterface |
| 8 | 8 | { |
| 9 | - private $_datos; |
|
| 9 | + private $_datos; |
|
| 10 | 10 | |
| 11 | - public function __construct(array $datos) |
|
| 12 | - { |
|
| 13 | - $this->_datos = $this->setDatos($datos); |
|
| 14 | - } |
|
| 11 | + public function __construct(array $datos) |
|
| 12 | + { |
|
| 13 | + $this->_datos = $this->setDatos($datos); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - public function datos(): array |
|
| 17 | - { |
|
| 18 | - return $this->_datos; |
|
| 19 | - } |
|
| 16 | + public function datos(): array |
|
| 17 | + { |
|
| 18 | + return $this->_datos; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - private function setDatos(array $array): array |
|
| 22 | - { |
|
| 23 | - $this->numeroDeElementosValido($array); |
|
| 24 | - $this->columnaEsString($array); |
|
| 25 | - $this->valoresNoSonIguales($array); |
|
| 26 | - $this->contieneValoresVacios($array); |
|
| 21 | + private function setDatos(array $array): array |
|
| 22 | + { |
|
| 23 | + $this->numeroDeElementosValido($array); |
|
| 24 | + $this->columnaEsString($array); |
|
| 25 | + $this->valoresNoSonIguales($array); |
|
| 26 | + $this->contieneValoresVacios($array); |
|
| 27 | 27 | |
| 28 | - return $array; |
|
| 29 | - } |
|
| 28 | + return $array; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - private function contieneValoresVacios($array): void |
|
| 32 | - { |
|
| 33 | - foreach ($array as $value) |
|
| 34 | - { |
|
| 35 | - if(empty($value)) |
|
| 36 | - { |
|
| 37 | - throw new Exception("Error Processing Request"); |
|
| 38 | - } |
|
| 39 | - } |
|
| 40 | - } |
|
| 31 | + private function contieneValoresVacios($array): void |
|
| 32 | + { |
|
| 33 | + foreach ($array as $value) |
|
| 34 | + { |
|
| 35 | + if(empty($value)) |
|
| 36 | + { |
|
| 37 | + throw new Exception("Error Processing Request"); |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - private function valoresNoSonIguales($array): void |
|
| 43 | - { |
|
| 44 | - if($array[1] == $array[2]) |
|
| 45 | - { |
|
| 46 | - throw new Exception("Error Processing Request"); |
|
| 47 | - } |
|
| 48 | - } |
|
| 42 | + private function valoresNoSonIguales($array): void |
|
| 43 | + { |
|
| 44 | + if($array[1] == $array[2]) |
|
| 45 | + { |
|
| 46 | + throw new Exception("Error Processing Request"); |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - private function numeroDeElementosValido($array): void |
|
| 51 | - { |
|
| 52 | - if(count($array) !== 3) |
|
| 53 | - { |
|
| 54 | - throw new Exception("Error Processing Request"); |
|
| 55 | - } |
|
| 56 | - } |
|
| 50 | + private function numeroDeElementosValido($array): void |
|
| 51 | + { |
|
| 52 | + if(count($array) !== 3) |
|
| 53 | + { |
|
| 54 | + throw new Exception("Error Processing Request"); |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - private function columnaEsString($array): void |
|
| 59 | - { |
|
| 60 | - if(!is_string($array[0])) |
|
| 61 | - { |
|
| 62 | - throw new Exception("Error Processing Request"); |
|
| 63 | - } |
|
| 64 | - } |
|
| 58 | + private function columnaEsString($array): void |
|
| 59 | + { |
|
| 60 | + if(!is_string($array[0])) |
|
| 61 | + { |
|
| 62 | + throw new Exception("Error Processing Request"); |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | 65 | } |
| 66 | 66 | \ No newline at end of file |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | |
| 20 | 20 | private function setTabla(string $tabla): string |
| 21 | 21 | { |
| 22 | - if(empty($tabla)) |
|
| 22 | + if (empty($tabla)) |
|
| 23 | 23 | { |
| 24 | 24 | throw new Exception("Error Processing Request"); |
| 25 | 25 | } |
@@ -5,25 +5,25 @@ |
||
| 5 | 5 | |
| 6 | 6 | class Tabla |
| 7 | 7 | { |
| 8 | - private $_tabla; |
|
| 8 | + private $_tabla; |
|
| 9 | 9 | |
| 10 | - public function __construct(string $Tabla) |
|
| 11 | - { |
|
| 12 | - $this->_tabla = $this->setTabla($Tabla); |
|
| 13 | - } |
|
| 10 | + public function __construct(string $Tabla) |
|
| 11 | + { |
|
| 12 | + $this->_tabla = $this->setTabla($Tabla); |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | - public function sql(): string |
|
| 16 | - { |
|
| 17 | - return $this->_tabla; |
|
| 18 | - } |
|
| 15 | + public function sql(): string |
|
| 16 | + { |
|
| 17 | + return $this->_tabla; |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - private function setTabla(string $tabla): string |
|
| 21 | - { |
|
| 22 | - if(empty($tabla)) |
|
| 23 | - { |
|
| 24 | - throw new Exception("Error Processing Request"); |
|
| 25 | - } |
|
| 20 | + private function setTabla(string $tabla): string |
|
| 21 | + { |
|
| 22 | + if(empty($tabla)) |
|
| 23 | + { |
|
| 24 | + throw new Exception("Error Processing Request"); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - return $tabla; |
|
| 28 | - } |
|
| 27 | + return $tabla; |
|
| 28 | + } |
|
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |