ILIAS
release_8 Revision v8.24
◀ ilDoc Overview
Alphanumeric.php
Go to the documentation of this file.
1
<?php
2
3
declare(strict_types=1);
4
5
/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
6
11
namespace
ILIAS\Data
;
12
13
use
ILIAS\Refinery\ConstraintViolationException
;
14
15
class
Alphanumeric
16
{
20
private
$value
;
21
26
public
function
__construct
(
$value
)
27
{
28
$matches =
null
;
29
if
(!preg_match(
'/^[a-zA-Z0-9]+$/'
, (
string
)
$value
, $matches)) {
30
throw
new
ConstraintViolationException
(
31
sprintf(
'The value "%s" is not an alphanumeric value.'
,
$value
),
32
'exception_not_alphanumeric'
,
33
array(
$value
)
34
);
35
}
36
37
$this->value =
$value
;
38
}
39
43
public
function
getValue
()
44
{
45
return
$this->value
;
46
}
47
48
public
function
asString
(): string
49
{
50
return
(
string
)
$this->value
;
51
}
52
}
ILIAS\Data\Alphanumeric
Definition:
Alphanumeric.php:16
ILIAS\Data\Alphanumeric\asString
asString()
Definition:
Alphanumeric.php:48
ILIAS\Data\Alphanumeric\$value
$value
Definition:
Alphanumeric.php:20
ILIAS\Data\Alphanumeric\getValue
getValue()
Definition:
Alphanumeric.php:43
ILIAS\Data\Alphanumeric\__construct
__construct($value)
Definition:
Alphanumeric.php:26
ILIAS\Refinery\ConstraintViolationException
Definition:
ConstraintViolationException.php:30
ILIAS\Data
Definition:
Alphanumeric.php:11
src
Data
Alphanumeric.php
Generated on Sun Nov 2 2025 22:01:56 for ILIAS by
1.9.4 (using
Doxyfile
)