ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
SuperGlobalDropInReplacement.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\HTTP\Wrapper;
22 
25 use LogicException;
27 
33 class SuperGlobalDropInReplacement extends KeyValueAccess
34 {
35  public function __construct(Factory $factory, array $raw_values, private bool $throwOnValueAssignment = false)
36  {
37  parent::__construct($raw_values, $factory->kindlyTo()->string());
38  }
39 
40  #[\Override]
41  public function offsetSet(mixed $offset, mixed $value): void
42  {
43  if ($this->throwOnValueAssignment) {
44  throw new OutOfBoundsException("Modifying global Request-Array such as \$_GET is not allowed!");
45  }
46 
47  parent::offsetSet($offset, $value);
48  }
49 
50  #[\Override]
51  public function offsetUnset(mixed $offset): void
52  {
53  throw new LogicException("Modifying global Request-Array such as \$_GET is not allowed!");
54  }
55 }
__construct(Factory $factory, array $raw_values, private bool $throwOnValueAssignment=false)
Class SuperGlobalDropInReplacement This Class wraps SuperGlobals such as $_GET and $_POST to prevent ...
Builds data types.
Definition: Factory.php:35
__construct(Container $dic, ilPlugin $plugin)