ILIAS
release_6 Revision v6.24-5-g0c8bfefb3b8
◀ ilDoc Overview
PositiveInteger.php
Go to the documentation of this file.
1
<?
php
2
declare(strict_types=1);
3
/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
9
namespace
ILIAS\Data
;
10
11
use
ILIAS\Refinery\ConstraintViolationException
;
12
13
class
PositiveInteger
14
{
18
private
$value
;
19
24
public
function
__construct
(
int
$value
)
25
{
26
$matches =
null
;
27
28
if
(
$value
< 0) {
29
throw
new
ConstraintViolationException
(
30
sprintf(
'The value "%s" is not a positive integer'
,
$value
),
31
'exception_not_positive_integer'
,
32
array(
$value
)
33
);
34
}
35
36
$this->value =
$value
;
37
}
38
42
public
function
getValue
() : int
43
{
44
return
(
int
)
$this->value
;
45
}
46
}
php
An exception for terminatinating execution or to throw for unit testing.
ILIAS\Data\PositiveInteger
Definition:
PositiveInteger.php:14
ILIAS\Data\PositiveInteger\$value
$value
Definition:
PositiveInteger.php:18
ILIAS\Data\PositiveInteger\getValue
getValue()
Definition:
PositiveInteger.php:42
ILIAS\Data\PositiveInteger\__construct
__construct(int $value)
Definition:
PositiveInteger.php:24
ILIAS\Refinery\ConstraintViolationException
Definition:
ConstraintViolationException.php:15
ILIAS\Data
Definition:
Alphanumeric.php:10
src
Data
PositiveInteger.php
Generated on Fri Oct 3 2025 20:01:14 for ILIAS by
1.9.4 (using
Doxyfile
)