docs: Improve documentation and translate comments to English

This commit is contained in:
kj
2025-10-10 21:18:22 -03:00
parent 674c9d5ff4
commit 7f62e06ff9
8 changed files with 369 additions and 307 deletions

View File

@@ -5,12 +5,12 @@ namespace Libs;
/**
* Request - DuckBrain
*
* Libería complementaria de la libería Router.
* Contiene el cuerpo básico de la petición http (POST, GET, JSON, etc).
* Complementary library to the Router library.
* Contains the basic body of the http request (POST, GET, JSON, etc).
*
* @author KJ
* @website https://kj2.me
* @licence MIT
* @license MIT
*/
class Request extends Neuron
{
@@ -28,7 +28,7 @@ class Request extends Neuron
/**
* __construct
*
* @param string $path Ruta actual tomando como raíz la instalación de DuckBrain.
* @param string $path Current path, taking the DuckBrain installation as root.
*/
public function __construct()
{
@@ -52,22 +52,22 @@ class Request extends Neuron
in_array($_SERVER['REQUEST_METHOD'], ['PUT', 'PATCH', 'DELETE']) &&
preg_match('/^[^;?\/:@&=+$,]{1,255}[=]/', $this->body, $matches)
) {
// Con la expresión regular verificamos que sea un http
// query string válido y evitamos errores de memoria en caso
// de que el body tenga algo más grande que eso.
// With the regular expression, we verify that it is a valid
// http query string and avoid memory errors in case
// the body contains something larger than that.
parse_str($this->body, $input_vars);
$this->{strtolower($_SERVER['REQUEST_METHOD'])} = new Neuron($input_vars);
}
}
// Corremos las validaciones configuradas
// Run configured validations
if (!$this->validate()) {
exit();
}
}
/**
* Inicia la validación que se haya configurado.
* Starts the configured validation.
*
* @return bool
*/
@@ -97,7 +97,7 @@ class Request extends Neuron
}
/**
* Reglas para el método actual.
* Rules for the current method.
*
* @return array
*/
@@ -107,7 +107,7 @@ class Request extends Neuron
}
/**
* Reglas para los parámetros por URL.
* Rules for URL parameters.
*
* @return array
*/
@@ -117,7 +117,7 @@ class Request extends Neuron
}
/**
* Reglas para los parámetros GET.
* Rules for GET parameters.
*
* @return array
*/
@@ -127,7 +127,7 @@ class Request extends Neuron
}
/**
* Mensajes de error en caso de fallar una validación.
* Error messages in case a validation fails.
*
* @return array
*/
@@ -137,7 +137,7 @@ class Request extends Neuron
}
/**
* Función a ejecutar cuando se ha detectado un valor no válido.
* Function to execute when an invalid value has been detected.
*
* @param string $error
*