blob: 0314c5d8870a740afbf29f659a196603e753bbbb [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 ParseErrorException extends BaseInvalidArgumentException implements InvalidArgumentException
18{
19 /**
20 * Constructor.
21 *
22 * @param string $expected
23 * @param string $actual
24 * @param int $code
25 * @param Exception|null $previous
26 */
27 public function __construct($expected, $actual, $help = '', $code = 0, Exception $previous = null)
28 {
29 $actual = $actual === '' ? 'data is missing' : "get '$actual'";
30
31 parent::__construct(trim("Format expected $expected but $actual\n$help"), $code, $previous);
32 }
33}