ILIAS
trunk Revision v13.0_alpha-62-g3b72d83f2e5
◀ ilDoc Overview
FinalizeNormalizing.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Processors
;
22
23
use
ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\NormalizingException
;
24
use
ILIAS\TestQuestionPool\ExportImport\Foundation\Queue\Processor
;
25
31
final
class
FinalizeNormalizing
implements
Processor
32
{
33
public
function
process
(
object
$carry): void
34
{
35
if
(!($carry instanceof
NormalizeCarry
)) {
36
return
;
37
}
38
39
if
($carry->hasResult()) {
40
$this->
ensureNormalized
($carry->result());
41
}
42
}
43
44
private
function
ensureNormalized
(mixed $value): mixed
45
{
46
if
(is_scalar($value) || $value ===
null
) {
47
return
$value;
48
}
49
50
if
(is_array($value)) {
51
return
array_map($this->
ensureNormalized
(...), $value);
52
}
53
54
throw
new
NormalizingException
(
'Value is not normalized: '
. get_debug_type($value));
55
}
56
}
ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\NormalizingException
Exception thrown when a value cannot be normalized or denormalized.
Definition:
NormalizingException.php:28
ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Processors\FinalizeNormalizing
Finalize the normalization of the value by ensuring that the value is normalized.
Definition:
FinalizeNormalizing.php:32
ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Processors\FinalizeNormalizing\ensureNormalized
ensureNormalized(mixed $value)
Definition:
FinalizeNormalizing.php:44
ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Processors\FinalizeNormalizing\process
process(object $carry)
Definition:
FinalizeNormalizing.php:33
ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Processors\NormalizeCarry
Carries a value, context and eventual result through normalization processors.
Definition:
NormalizeCarry.php:12
ILIAS\TestQuestionPool\ExportImport\Foundation\Queue\Processor
Definition:
Processor.php:24
ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Processors
Definition:
CollectResources.php:21
components
ILIAS
TestQuestionPool
src
ExportImport
Foundation
Normalize
Processors
FinalizeNormalizing.php
Generated on Wed Nov 11 2026 23:10:46 for ILIAS by
1.9.4 (using
Doxyfile
)