| Total Complexity | 4 | 
| Total Lines | 25 | 
| Duplicated Lines | 0 % | 
| Coverage | 0% | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 18 | class ValidateException extends \RuntimeException | ||
| 19 | { | ||
| 20 | public function __construct(protected $error, protected $key = '') | ||
| 21 |     { | ||
| 22 | $this->message = is_array($error) ? json_encode($error) : $error; | ||
| 23 | } | ||
| 24 | |||
| 25 | /** | ||
| 26 | * 获取验证错误信息 | ||
| 27 | * @access public | ||
| 28 | * @return array|string | ||
| 29 | */ | ||
| 30 | public function getError() | ||
| 31 |     { | ||
| 32 | return $this->error; | ||
| 33 | } | ||
| 34 | |||
| 35 | /** | ||
| 36 | * 获取验证错误字段 | ||
| 37 | * @access public | ||
| 38 | * @return string | ||
| 39 | */ | ||
| 40 | public function getKey() | ||
| 43 | } | ||
| 44 | |||
| 45 | } | ||
| 46 |