ILIAS
trunk Revision v11.0_alpha-3011-gc6b235a2e85
◀ ilDoc Overview
Utf8Mb4Sanitizer.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Mail\Transformation
;
22
23
use
ilDBConstants
;
24
use
ILIAS\Refinery\ConstraintViolationException
;
25
use
ILIAS\Refinery\DeriveApplyToFromTransform
;
26
use
ILIAS\Refinery\DeriveInvokeFromTransform
;
27
use
ILIAS\Refinery\Transformation
;
28
29
class
Utf8Mb4Sanitizer
implements
Transformation
30
{
31
use DeriveApplyToFromTransform;
32
use DeriveInvokeFromTransform;
33
34
public
function
transform
($from): string
35
{
36
if
(!\is_string($from)) {
37
throw
new
ConstraintViolationException
(
38
'Value to be transformed must be of type string'
,
39
'not_string'
40
);
41
}
42
43
return
preg_replace(
44
'/[\x{10000}-\x{10FFFF}]/u'
,
45
ilDBConstants::MB4_REPLACEMENT
,
46
$from
47
);
48
}
49
}
ILIAS\Mail\Transformation\Utf8Mb4Sanitizer
Definition:
Utf8Mb4Sanitizer.php:30
ILIAS\Mail\Transformation\Utf8Mb4Sanitizer\transform
transform($from)
Perform the transformation.
Definition:
Utf8Mb4Sanitizer.php:34
ILIAS\Refinery\ConstraintViolationException
Definition:
ConstraintViolationException.php:30
ILIAS\Refinery\DeriveInvokeFromTransform
trait DeriveInvokeFromTransform
Definition:
DeriveInvokeFromTransform.php:24
ILIAS\Refinery\DeriveApplyToFromTransform
trait DeriveApplyToFromTransform
Definition:
DeriveApplyToFromTransform.php:29
ilDBConstants
Class ilDBConstants.
Definition:
class.ilDBConstants.php:27
ilDBConstants\MB4_REPLACEMENT
const MB4_REPLACEMENT
Definition:
class.ilDBConstants.php:92
ILIAS\Refinery\Transformation
A transformation is a function from one datatype to another.
Definition:
Transformation.php:35
ILIAS\Mail\Transformation
Definition:
Utf8Mb4Sanitizer.php:21
components
ILIAS
Mail
classes
Transformation
Utf8Mb4Sanitizer.php
Generated on Sat Oct 18 2025 23:03:24 for ILIAS by
1.9.4 (using
Doxyfile
)