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