ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilForumRequestTrait.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
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 }
$param
Definition: xapitoken.php:46
retrieve(string $key, Transformation $transformation)