PocketMine-MP 5.16.1 git-585aee9386a787c95e73dd0a05ffca8329606b68
ErrorTypeToStringMap.php
1<?php
2
3/*
4 * PocketMine Standard PHP Library
5 * Copyright (C) 2019 PocketMine Team <https://github.com/pmmp/PocketMine-SPL>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16*/
17
18declare(strict_types=1);
19
20namespace pocketmine\errorhandler;
21
23 private const ERROR_STRINGS = [
24 0 => "EXCEPTION",
25 E_ERROR => "E_ERROR",
26 E_WARNING => "E_WARNING",
27 E_PARSE => "E_PARSE",
28 E_NOTICE => "E_NOTICE",
29 E_CORE_ERROR => "E_CORE_ERROR",
30 E_CORE_WARNING => "E_CORE_WARNING",
31 E_COMPILE_ERROR => "E_COMPILE_ERROR",
32 E_COMPILE_WARNING => "E_COMPILE_WARNING",
33 E_USER_ERROR => "E_USER_ERROR",
34 E_USER_WARNING => "E_USER_WARNING",
35 E_USER_NOTICE => "E_USER_NOTICE",
36 E_STRICT => "E_STRICT",
37 E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
38 E_DEPRECATED => "E_DEPRECATED",
39 E_USER_DEPRECATED => "E_USER_DEPRECATED"
40 ];
41
42 private function __construct(){
43
44 }
45
51 public static function get(int $errorType) : string{
52 if(!isset(self::ERROR_STRINGS[$errorType])){
53 throw new \InvalidArgumentException("Invalid error type $errorType");
54 }
55
56 return self::ERROR_STRINGS[$errorType];
57 }
58}