Use enum for error classification

Close #1
This commit is contained in:
2024-06-11 22:30:04 +02:00
parent 410aa4a92c
commit b1d25b4941
2 changed files with 32 additions and 10 deletions

28
MDErrorCategory.php Normal file
View File

@ -0,0 +1,28 @@
<?PHP
/**
* Represents an error category.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents an error category.
*/
enum MDErrorCategory implements JsonSerializable {
case unknown;
case critical;
case known;
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}