ILIAS  release_8 Revision v8.24
ArrayInputData.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use LogicException;
24
28class ArrayInputData implements InputData
29{
30 protected array $data;
31
32 public function __construct(array $data)
33 {
34 $this->data = $data;
35 }
36
37 public function get($name)
38 {
39 if (!$this->has($name)) {
40 throw new LogicException("'$name' is not contained in provided data.");
41 }
42
43 return $this->data[$name];
44 }
45
46 public function getOr($name, $default)
47 {
48 return $this->data[$name] ?? $default;
49 }
50
51 public function has($name): bool
52 {
53 return array_key_exists($name, $this->data);
54 }
55}
Describes how Input-Elements want to interact with posted data.
Definition: InputData.php:30
if($format !==null) $name
Definition: metadata.php:247
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...