| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 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 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
protected $className; |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 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 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
public function getClassName(): string |
| 53 |
{ |
| 54 |
return $this->className; |
| 55 |
} |
| 56 |
} |