| 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 InvalidArgumentException as BaseInvalidArgumentException; |
| 17 |
use Throwable; |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
class OutOfRangeException extends BaseInvalidArgumentException implements InvalidArgumentException |
| 23 |
{ |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
private $unit; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
private $min; |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
private $max; |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
private $value; |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
public function __construct($unit, $min, $max, $value, $code = 0, ?Throwable $previous = null) |
| 63 |
{ |
| 64 |
$this->unit = $unit; |
| 65 |
$this->min = $min; |
| 66 |
$this->max = $max; |
| 67 |
$this->value = $value; |
| 68 |
|
| 69 |
parent::__construct("$unit must be between $min and $max, $value given", $code, $previous); |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
public function getMax() |
| 76 |
{ |
| 77 |
return $this->max; |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
public function getMin() |
| 84 |
{ |
| 85 |
return $this->min; |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
public function getUnit() |
| 92 |
{ |
| 93 |
return $this->unit; |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
public function getValue() |
| 100 |
{ |
| 101 |
return $this->value; |
| 102 |
} |
| 103 |
} |