- }
-
- /* Returning a string that contains the error message. */
- private static function csvError(string $description): string
- {
- return '"error"' . "\r\n" . "\"$description\"" . "\r\n";
- }
-
- /**
- * Returns a string containing an HTML paragraph element with the error code and description
- *
- * @param $code int|string The error code.
- * @param $description string The description of the error.
- *
- * @return string A string.
- */
- private static function htmlError(int|string $code, string $description): string
- {
- return '<p>ERROR: (' . $code . ') ' . $description . '</p>';
- }
-
- /**
- * Returns a JSON string with the error code and description
- *
- * @param $code int|string The error code.
- * @param $description string The description of the error.
- *
- * @return bool|string A JSON string
- */
- private static function jsonError(int|string $code, string $description): bool|string
- {
- return json_encode([
- 'success' => false,
- 'errorcode' => $code,
- 'description' => $description,
- ], JSON_PRETTY_PRINT);
- }
-
- /**
- * Returns a string that contains the error code and description
- *
- * @param $code int|string The error code.
- * @param $description string The description of the error.
- *
- * @return string A string with the error code and description.
- */
- private static function textError(int|string $code, string $description): string
- {
- return 'ERROR: (' . $code . ') ' . $description;
- }
-
- /**
- * "If the type is csv, then call the csvSuccess function,
- * if the type is html, then call the htmlSuccess function, etc."
- *
- * The `match` keyword is a new feature in PHP 8. It's a lot like a switch statement, but it's more powerful
- *
- * @param $files array An array of file objects.
- */
- public function send(array $files): void
- {
- $response = match ($this->type) {
- 'csv' => $this->csvSuccess($files),
- 'html' => $this->htmlSuccess($files),
- 'json' => $this->jsonSuccess($files),
- 'text' => $this->textSuccess($files),
- };
+ exit(1);
+ }
+
+ /* Returning a string that contains the error message. */
+ private static function csvError(string $description):string
+ {
+ return '"error"' . "\r\n" . "\"$description\"" . "\r\n";
+ }
+
+ /**
+ * Returns a string containing an HTML paragraph element with the error code and description
+ *
+ * @param $code int|string The error code.
+ * @param $description string The description of the error.
+ *
+ * @return string A string.
+ */
+ private static function htmlError(int|string $code, string $description):string
+ {
+ return '<p>ERROR: (' . $code . ') ' . $description . '</p>';
+ }
+
+ /**
+ * Returns a JSON string with the error code and description
+ *
+ * @param $code int|string The error code.
+ * @param $description string The description of the error.
+ *
+ * @return bool|string A JSON string
+ */
+ private static function jsonError(int|string $code, string $description):bool|string
+ {
+ return json_encode([
+ 'success' => false,
+ 'errorcode' => $code,
+ 'description' => $description,
+ ], JSON_PRETTY_PRINT);
+ }
+
+ /**
+ * Returns a string that contains the error code and description
+ *
+ * @param $code int|string The error code.
+ * @param $description string The description of the error.
+ *
+ * @return string A string with the error code and description.
+ */
+ private static function textError(int|string $code, string $description):string
+ {
+ return 'ERROR: (' . $code . ') ' . $description;
+ }
+
+ /**
+ * "If the type is csv, then call the csvSuccess function,
+ * if the type is html, then call the htmlSuccess function, etc."
+ *
+ * The `match` keyword is a new feature in PHP 8. It's a lot like a switch statement, but it's more powerful
+ *
+ * @param $files array An array of file objects.
+ */
+ public function send(array $files):void
+ {
+ $response = match ($this->type) {
+ 'csv' => $this->csvSuccess($files),
+ 'html' => $this->htmlSuccess($files),
+ 'json' => $this->jsonSuccess($files),
+ 'text' => $this->textSuccess($files),
+ };