ILIAS
trunk Revision v11.0_alpha-2638-g80c1d007f79
◀ ilDoc Overview
StringTransformation.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Refinery\To\Transformation
;
22
23
use
ILIAS\Refinery\DeriveApplyToFromTransform
;
24
use
ILIAS\Refinery\DeriveInvokeFromTransform
;
25
use
ILIAS\Refinery\Constraint
;
26
use
ILIAS\Refinery\ProblemBuilder
;
27
use
UnexpectedValueException
;
28
29
class
StringTransformation
implements
Constraint
30
{
31
use
DeriveApplyToFromTransform
;
32
use
DeriveInvokeFromTransform
;
33
use
ProblemBuilder
;
34
38
public
function
transform
($from): string
39
{
40
$this->
check
($from);
41
return
(
string
) $from;
42
}
43
47
public
function
getError
(): string
48
{
49
return
'The value MUST be of type string.'
;
50
}
51
55
public
function
check
($value)
56
{
57
if
(!$this->
accepts
($value)) {
58
throw
new
UnexpectedValueException
($this->
getErrorMessage
($value));
59
}
60
61
return
null
;
62
}
63
67
public
function
accepts
($value): bool
68
{
69
return
is_string($value);
70
}
71
75
public
function
problemWith
($value): ?string
76
{
77
if
(!$this->
accepts
($value)) {
78
return
$this->
getErrorMessage
($value);
79
}
80
81
return
null
;
82
}
83
}
ILIAS\Refinery\To\Transformation\StringTransformation\problemWith
problemWith($value)
Definition:
StringTransformation.php:75
ILIAS\Refinery\To\Transformation\StringTransformation\check
check($value)
Definition:
StringTransformation.php:55
ILIAS\Refinery\DeriveInvokeFromTransform
trait DeriveInvokeFromTransform
Definition:
DeriveInvokeFromTransform.php:24
ILIAS\Refinery\DeriveApplyToFromTransform
trait DeriveApplyToFromTransform
Definition:
DeriveApplyToFromTransform.php:29
ILIAS\Refinery\Constraint
A constraint encodes some resrtictions on values.
Definition:
Constraint.php:31
ILIAS\Refinery\To\Transformation
Definition:
BooleanTransformation.php:21
UnexpectedValueException
null
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Definition:
shib_logout.php:144
ILIAS\Refinery\To\Transformation\StringTransformation\getError
getError()
Definition:
StringTransformation.php:47
ILIAS\Refinery\To\Transformation\StringTransformation
Definition:
StringTransformation.php:29
ILIAS\Refinery\getErrorMessage
getErrorMessage($value)
Definition:
ProblemBuilder.php:39
ILIAS\Refinery\ProblemBuilder
trait ProblemBuilder
Definition:
ProblemBuilder.php:26
ILIAS\Refinery\To\Transformation\StringTransformation\accepts
accepts($value)
Definition:
StringTransformation.php:67
Constraint
ILIAS\Refinery\To\Transformation\StringTransformation\transform
transform($from)
Definition:
StringTransformation.php:38
components
ILIAS
Refinery
src
To
Transformation
StringTransformation.php
Generated on Sun Aug 31 2025 23:03:32 for ILIAS by
1.8.13 (using
Doxyfile
)