Exception   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 29
c 1
b 0
f 0
dl 0
loc 74
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yansongda\Pay\Exception;
6
7
use Throwable;
8
9
class Exception extends \Exception
10
{
11
    public const UNKNOWN_ERROR = 9999;
12
13
    /*
14
     * 关于参数.
15
     */
16
    public const PARAMS_SHORTCUT_ACTION_INVALID = 9210;
17
18
    public const PARAMS_METHOD_NOT_SUPPORTED = 9211;
19
20
    public const PARAMS_WECHAT_PAPAY_TYPE_NOT_SUPPORTED = 9212;
21
22
    public const PARAMS_WECHAT_URL_MISSING = 9213;
23
24
    public const PARAMS_WECHAT_BODY_MISSING = 9214;
25
26
    public const PARAMS_WECHAT_SERIAL_NOT_FOUND = 9215;
27
28
    public const PARAMS_UNIPAY_URL_MISSING = 9216;
29
30
    public const PARAMS_UNIPAY_BODY_MISSING = 9217;
31
32
    public const PARAMS_NECESSARY_PARAMS_MISSING = 9218;
33
34
    public const PARAMS_PLUGIN_ONLY_SUPPORT_SERVICE_MODE = 9219;
35
36
    public const PARAMS_PLUGIN_ONLY_SUPPORT_NORMAL_MODE = 9220;
37
38
    public const PARAMS_CALLBACK_REQUEST_INVALID = 9221;
39
40
    /**
41
     * 关于响应.
42
     */
43
    public const RESPONSE_CODE_WRONG = 9304;
44
45
    public const RESPONSE_MISSING_NECESSARY_PARAMS = 9305;
46
47
    /*
48
     * 关于配置.
49
     */
50
    public const CONFIG_ALIPAY_INVALID = 9401;
51
52
    public const CONFIG_WECHAT_INVALID = 9402;
53
54
    public const CONFIG_UNIPAY_INVALID = 9403;
55
56
    /**
57
     * 关于签名.
58
     */
59
    public const SIGN_ERROR = 9500;
60
61
    public const SIGN_EMPTY = 9501;
62
63
    /**
64
     * 关于加解密.
65
     */
66
    public const DECRYPT_ERROR = 9600;
67
68
    public const DECRYPT_WECHAT_CIPHERTEXT_PARAMS_INVALID = 9601;
69
70
    public const DECRYPT_WECHAT_ENCRYPTED_DATA_INVALID = 9602;
71
72
    public const DECRYPT_WECHAT_DECRYPTED_METHOD_INVALID = 9603;
73
74
    public const DECRYPT_WECHAT_ENCRYPTED_CONTENTS_INVALID = 9604;
75
76
    public mixed $extra;
77
78
    public function __construct(string $message = '未知异常', int $code = self::UNKNOWN_ERROR, mixed $extra = null, ?Throwable $previous = null)
79
    {
80
        $this->extra = $extra;
81
82
        parent::__construct($message, $code, $previous);
83
    }
84
}
85