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