Schema
3 years ago
Builder.php
1 year ago
Schema.php
8 months ago
ValidationException.php
4 years ago
Validator.php
3 years ago
index.php
3 years ago
ValidationException.php
26 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\Validator; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\UnexpectedValueException; |
| 9 | use WP_Error; |
| 10 | |
| 11 | class ValidationException extends UnexpectedValueException { |
| 12 | /** @var WP_Error */ |
| 13 | protected $wpError; |
| 14 | |
| 15 | public static function createFromWpError(WP_Error $wpError): self { |
| 16 | $exception = self::create() |
| 17 | ->withMessage($wpError->get_error_message()); |
| 18 | $exception->wpError = $wpError; |
| 19 | return $exception; |
| 20 | } |
| 21 | |
| 22 | public function getWpError(): WP_Error { |
| 23 | return $this->wpError; |
| 24 | } |
| 25 | } |
| 26 |