blob: f5dbfe2fd8a3c605c8b0bef8c5b8e8e45a8e8fee [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?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 */
11namespace Carbon\Exceptions;
12
13use Exception;
14use InvalidArgumentException as BaseInvalidArgumentException;
15
16class InvalidDateException extends BaseInvalidArgumentException implements InvalidArgumentException
17{
18 /**
19 * The invalid field.
20 *
21 * @var string
22 */
23 private $field;
24
25 /**
26 * The invalid value.
27 *
28 * @var mixed
29 */
30 private $value;
31
32 /**
33 * Constructor.
34 *
35 * @param string $field
36 * @param mixed $value
37 * @param int $code
38 * @param Exception|null $previous
39 */
40 public function __construct($field, $value, $code = 0, Exception $previous = null)
41 {
42 $this->field = $field;
43 $this->value = $value;
44 parent::__construct($field.' : '.$value.' is not a valid value.', $code, $previous);
45 }
46
47 /**
48 * Get the invalid field.
49 *
50 * @return string
51 */
52 public function getField()
53 {
54 return $this->field;
55 }
56
57 /**
58 * Get the invalid value.
59 *
60 * @return mixed
61 */
62 public function getValue()
63 {
64 return $this->value;
65 }
66}