Debian Codegraph @

lib/3rdParty/composer/nesbot/carbon/src/Carbon/Exceptions/ImmutableException.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 /**
6 * This file is part of the Carbon package.
7 *
8 * (c) Brian Nesbitt <[email protected]>
9 *
10 * For the full copyright and license information, please view the LICENSE
11 * file that was distributed with this source code.
12 */
13
14 namespace Carbon\Exceptions;
15
16 use RuntimeException as BaseRuntimeException;
17 use Throwable;
18
19 class ImmutableException extends BaseRuntimeException implements RuntimeException
20 {
21 /**
22 * The value.
23 *
24 * @var string
25 */
26 protected $value;
27
28 /**
29 * Constructor.
30 *
31 * @param string $value the immutable type/value
32 * @param int $code
33 * @param Throwable|null $previous
34 */
35 public function __construct($value, $code = 0, ?Throwable $previous = null)
36 {
37 $this->value = $value;
38 parent::__construct("$value is immutable.", $code, $previous);
39 }
40
41 /**
42 * Get the value.
43 *
44 * @return string
45 */
46 public function getValue(): string
47 {
48 return $this->value;
49 }
50 }