payload = $payload; $this->satisfied = $satisfied; } /** * Returns a response indicating that the request was completed successfully, with the given `payload` and * `satisfied` set to `true`. * * @param ?mixed $payload the payload to attach to the `Response` * @return Response a response with the given `payload` and `satisfied` set to `true`. */ public static function satisfied(mixed $payload = null): Response { return new Response(payload: $payload, satisfied: true); } /** * Returns a response indicating something went wrong, with `payload` describing what went wrong in what place and * `satisfied` set to `false`. * * @param ?string $message the message to show to the user, or `null` if no message should be shown * @param ?string $target the name of the input field that caused an error, or `null` if no single input is to be * blamed * @return Response a response with `payload` describing what went wrong in what place and `satisfied` set to * `false` */ public static function unsatisfied(?string $message, ?string $target = null): Response { return new Response(payload: ["message" => $message, "target" => $target], satisfied: false); } }