| 1 | <?php |
| 2 | |
| 3 | require_once __DIR__ . "/BAD_REQUEST.php"; |
| 4 | require_once __DIR__ . "/ProblemDetails.php"; |
| 5 | |
| 6 | function validaCue(false|string $cue) |
| 7 | { |
| 8 | |
| 9 | if ($cue === false) |
| 10 | throw new ProblemDetails( |
| 11 | status: BAD_REQUEST, |
| 12 | title: "Falta el cue.", |
| 13 | type: "/error/faltacue.html", |
| 14 | detail: "La solicitud no tiene el valor de cue.", |
| 15 | ); |
| 16 | |
| 17 | $trimCue = trim($cue); |
| 18 | |
| 19 | if ($trimCue === "") |
| 20 | throw new ProblemDetails( |
| 21 | status: BAD_REQUEST, |
| 22 | title: "Cue en blanco.", |
| 23 | type: "/error/cuenblanco.html", |
| 24 | detail: "Pon texto en el campo cue.", |
| 25 | ); |
| 26 | |
| 27 | return $trimCue; |
| 28 | } |
| 29 | |