public static function factory($message, $code, $file, $line, \Exception $prev = null)
    {
        $exception = null;
        switch($code) {
            case E_WARNING:
            case E_USER_WARNING:
            case E_COMPILE_WARNING:
            case E_CORE_WARNING:
                $exception = PHPWarningException::class;
                break;
            case E_NOTICE:
            case E_USER_NOTICE:
                $exception = PHPNoticeException::class;
                break;
            case E_DEPRECATED:
            case E_USER_DEPRECATED:
                $exception = PHPDepreciatedException::class;
                break;
            case E_STRICT:
                $exception = PHPStrictException::class;
                break;
            case E_PARSE:
                $exception = PHPParseException::class;
                break;
            default:
                $exception = PHPErrorException::class;
                break;
        }
        
        return new $exception(
            $message,
            $code,
            $file,
            $line,
            $prev
        );
    }