<?php
const response_codes = [
["Usuario incorrecto.", false],
["Password incorrecta.", false],
["Credenciales inválidas.", false],
["Logueado correctamente.", true],
["No se pudo conectar al servidor LDAP para validar las credenciales.", false]
];
/**
* Looks up response id in response codes and return the appropriate message
*
* @param [int] $responseId - the id of the response.
* @return array(string, bool) the response message and false if it is an error or true if it a success.
*/
function interpretResponse($id)
{
return response_codes[$id] ?? ["Error desconocido", false];
}
for ($x = 0; $x < 6; ++$x) {
var_export(interpretResponse($x));
echo "\n";
}