Debian Codegraph @

lib/3rdParty/composer/nesbot/carbon/src/Carbon/Exceptions/NotACarbonClassException.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 Carbon\CarbonInterface;
17 use InvalidArgumentException as BaseInvalidArgumentException;
18 use Throwable;
19
20 class NotACarbonClassException extends BaseInvalidArgumentException implements InvalidArgumentException
21 {
22 /**
23 * The className.
24 *
25 * @var string
26 */
27 protected $className;
28
29 /**
30 * Constructor.
31 *
32 * @param string $className
33 * @param int $code
34 * @param Throwable|null $previous
35 */
36 public function __construct($className, $code = 0, ?Throwable $previous = null)
37 {
38 $this->className = $className;
39
40 parent::__construct(\sprintf(
41 'Given class does not implement %s: %s',
42 CarbonInterface::class,
43 $className,
44 ), $code, $previous);
45 }
46
47 /**
48 * Get the className.
49 *
50 * @return string
51 */
52 public function getClassName(): string
53 {
54 return $this->className;
55 }
56 }