Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
TypeError.php
Go to the documentation of this file.
1<?php
2
3
5
6
7class TypeError {
8 const ERRORS=[E_ERROR=>'Error',E_PARSE=>'Parse exception',E_COMPILE_ERROR=>'Compile error',E_WARNING=>'Warning'];
9 public static function asString($error){
10 if($error instanceof \Error || $error instanceof \Exception){
11 return \get_class($error);
12 }
13 if(\is_int($error)) {
14 return self::ERRORS[$error] ?? $error;
15 }
16 if(is_string($error)) {
17 return $error;
18 }
19 return 'Unknown error';
20 }
21
22}