Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This file is part of the Carbon package. |
| 5 | * |
| 6 | * (c) Brian Nesbitt <brian@nesbot.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 11 | |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 12 | namespace Carbon\Exceptions; |
| 13 | |
| 14 | use Exception; |
| 15 | use InvalidArgumentException as BaseInvalidArgumentException; |
| 16 | |
| 17 | class InvalidDateException extends BaseInvalidArgumentException implements InvalidArgumentException |
| 18 | { |
| 19 | /** |
| 20 | * The invalid field. |
| 21 | * |
| 22 | * @var string |
| 23 | */ |
| 24 | private $field; |
| 25 | |
| 26 | /** |
| 27 | * The invalid value. |
| 28 | * |
| 29 | * @var mixed |
| 30 | */ |
| 31 | private $value; |
| 32 | |
| 33 | /** |
| 34 | * Constructor. |
| 35 | * |
| 36 | * @param string $field |
| 37 | * @param mixed $value |
| 38 | * @param int $code |
| 39 | * @param Exception|null $previous |
| 40 | */ |
| 41 | public function __construct($field, $value, $code = 0, Exception $previous = null) |
| 42 | { |
| 43 | $this->field = $field; |
| 44 | $this->value = $value; |
| 45 | parent::__construct($field.' : '.$value.' is not a valid value.', $code, $previous); |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Get the invalid field. |
| 50 | * |
| 51 | * @return string |
| 52 | */ |
| 53 | public function getField() |
| 54 | { |
| 55 | return $this->field; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Get the invalid value. |
| 60 | * |
| 61 | * @return mixed |
| 62 | */ |
| 63 | public function getValue() |
| 64 | { |
| 65 | return $this->value; |
| 66 | } |
| 67 | } |