Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 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
 */
11
 
12
namespace Carbon\Exceptions;
13
 
14
use InvalidArgumentException as BaseInvalidArgumentException;
15
use Throwable;
16
 
17
class ParseErrorException extends BaseInvalidArgumentException implements InvalidArgumentException
18
{
19
    /**
20
     * The expected.
21
     *
22
     * @var string
23
     */
24
    protected $expected;
25
 
26
    /**
27
     * The actual.
28
     *
29
     * @var string
30
     */
31
    protected $actual;
32
 
33
    /**
34
     * The help message.
35
     *
36
     * @var string
37
     */
38
    protected $help;
39
 
40
    /**
41
     * Constructor.
42
     *
43
     * @param string         $expected
44
     * @param string         $actual
45
     * @param int            $code
46
     * @param Throwable|null $previous
47
     */
48
    public function __construct($expected, $actual, $help = '', $code = 0, Throwable $previous = null)
49
    {
50
        $this->expected = $expected;
51
        $this->actual = $actual;
52
        $this->help = $help;
53
 
54
        $actual = $actual === '' ? 'data is missing' : "get '$actual'";
55
 
56
        parent::__construct(trim("Format expected $expected but $actual\n$help"), $code, $previous);
57
    }
58
 
59
    /**
60
     * Get the expected.
61
     *
62
     * @return string
63
     */
64
    public function getExpected(): string
65
    {
66
        return $this->expected;
67
    }
68
 
69
    /**
70
     * Get the actual.
71
     *
72
     * @return string
73
     */
74
    public function getActual(): string
75
    {
76
        return $this->actual;
77
    }
78
 
79
    /**
80
     * Get the help message.
81
     *
82
     * @return string
83
     */
84
    public function getHelp(): string
85
    {
86
        return $this->help;
87
    }
88
}