ILIAS  release_8 Revision v8.24
ilForumRequestTrait.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23trait ilForumRequestTrait
24{
25 private function retrieveIntOrZeroFrom(ArrayBasedRequestWrapper $wrapper, string $param): int
26 {
27 $value = 0;
28 if ($wrapper->has($param)) {
29 $value = $wrapper->retrieve(
30 $param,
31 $this->refinery->byTrying([
32 $this->refinery->kindlyTo()->int(),
33 $this->refinery->custom()->transformation(static function ($value): int {
34 if ($value === '') {
35 return 0;
36 }
37
38 return $value;
39 })
40 ])
41 );
42 }
43
44 return $value;
45 }
46}
static return function(ContainerConfigurator $containerConfigurator)
Definition: basic_rector.php:9
retrieve(string $key, Transformation $transformation)
@inheritDoc
$param
Definition: xapitoken.php:46