Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
ArgumentOutOfRangeException.php
1<?php
2
3declare(strict_types=1);
4
6
8{
9 protected mixed $lowerLimit;
10 protected mixed $upperLimit;
11
12 public function __construct(string $parameter, mixed $lowerLimit = null, mixed $upperLimit = null, \Exception $previous = null)
13 {
14 if (\is_array($lowerLimit))
15 {
16 $message = sprintf("The value of an argument '%s' is outside the allowable range of values: %s", $parameter, implode(", ", $lowerLimit));
17 }
18 elseif (($lowerLimit !== null) && ($upperLimit !== null))
19 {
20 $message = sprintf("The value of an argument '%s' is outside the allowable range of values: from %s to %s", $parameter, $lowerLimit, $upperLimit);
21 }
22 elseif (($lowerLimit === null) && ($upperLimit !== null))
23 {
24 $message = sprintf("The value of an argument '%s' is outside the allowable range of values: not greater than %s", $parameter, $upperLimit);
25 }
26 elseif (($lowerLimit !== null) && ($upperLimit === null))
27 {
28 $message = sprintf("The value of an argument '%s' is outside the allowable range of values: not less than %s", $parameter, $lowerLimit);
29 } else
30 {
31 $message = sprintf("The value of an argument '%s' is outside the allowable range of values", $parameter);
32 }
33
34 $this->lowerLimit = $lowerLimit;
35 $this->upperLimit = $upperLimit;
36
37 parent::__construct($message, $parameter, $previous);
38 }
39
40 public function getLowerLimitType(): mixed
41 {
42 return $this->lowerLimit;
43 }
44
45 public function getUpperType(): mixed
46 {
47 return $this->upperLimit;
48 }
49}
__construct(string $parameter, mixed $lowerLimit=null, mixed $upperLimit=null, \Exception $previous=null)