Files
apimacro/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownUnitException.php

49 lines
902 B
PHP
Raw Normal View History

2024-05-07 12:17:25 +02:00
<?php
/**
* This file is part of the Carbon package.
*
* (c) Brian Nesbitt <brian@nesbot.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Carbon\Exceptions;
2024-05-17 12:24:19 +00:00
use Throwable;
2024-05-07 12:17:25 +02:00
class UnknownUnitException extends UnitException
{
2024-05-17 12:24:19 +00:00
/**
* The unit.
*
* @var string
*/
protected $unit;
2024-05-07 12:17:25 +02:00
/**
* Constructor.
*
* @param string $unit
* @param int $code
2024-05-17 12:24:19 +00:00
* @param Throwable|null $previous
2024-05-07 12:17:25 +02:00
*/
2024-05-17 12:24:19 +00:00
public function __construct($unit, $code = 0, Throwable $previous = null)
2024-05-07 12:17:25 +02:00
{
2024-05-17 12:24:19 +00:00
$this->unit = $unit;
2024-05-07 12:17:25 +02:00
parent::__construct("Unknown unit '$unit'.", $code, $previous);
}
2024-05-17 12:24:19 +00:00
/**
* Get the unit.
*
* @return string
*/
public function getUnit(): string
{
return $this->unit;
}
2024-05-07 12:17:25 +02:00
}