ILIAS
trunk Revision v12.0_alpha-1540-g00f839d5fa1
◀ ilDoc Overview
Alphanumeric.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
25
namespace
ILIAS\Data
;
26
27
use
ILIAS\Refinery\ConstraintViolationException
;
28
29
class
Alphanumeric
30
{
34
private
$value
;
35
40
public
function
__construct
(
$value
)
41
{
42
$matches =
null
;
43
if
(!preg_match(
'/^[a-zA-Z0-9]+$/'
, (
string
)
$value
, $matches)) {
44
throw
new
ConstraintViolationException
(
45
sprintf(
'The value "%s" is not an alphanumeric value.'
,
$value
),
46
'exception_not_alphanumeric'
,
47
array(
$value
)
48
);
49
}
50
51
$this->value =
$value
;
52
}
53
57
public
function
getValue
()
58
{
59
return
$this->value
;
60
}
61
62
public
function
asString
(): string
63
{
64
return
(
string
)
$this->value
;
65
}
66
}
ILIAS\Data\Alphanumeric
Definition:
Alphanumeric.php:30
ILIAS\Data\Alphanumeric\asString
asString()
Definition:
Alphanumeric.php:62
ILIAS\Data\Alphanumeric\$value
$value
Definition:
Alphanumeric.php:34
ILIAS\Data\Alphanumeric\getValue
getValue()
Definition:
Alphanumeric.php:57
ILIAS\Data\Alphanumeric\__construct
__construct($value)
Definition:
Alphanumeric.php:40
ILIAS\Refinery\ConstraintViolationException
Definition:
ConstraintViolationException.php:30
ILIAS\Data
Definition:
Alphanumeric.php:25
components
ILIAS
Data
src
Alphanumeric.php
Generated on Wed Jun 3 2026 23:04:34 for ILIAS by
1.9.4 (using
Doxyfile
)