blob: 99bb91c05eb6dfadc028fc74a55ea76d949ba250 [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 */
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010011
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +020012namespace Carbon\Exceptions;
13
14use Exception;
15use InvalidArgumentException as BaseInvalidArgumentException;
16
17class 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}