ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
SuperGlobalDropInReplacement.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
21 namespace ILIAS\HTTP\Wrapper;
22 
25 use LogicException;
27 
34 {
36 
37  public function __construct(Factory $factory, array $raw_values, bool $throwOnValueAssignment = false)
38  {
39  $this->throwOnValueAssignment = $throwOnValueAssignment;
40  parent::__construct($raw_values, $factory->kindlyTo()->string());
41  }
42 
43  public function offsetSet(mixed $offset, mixed $value): void
44  {
45  if ($this->throwOnValueAssignment) {
46  throw new OutOfBoundsException("Modifying global Request-Array such as \$_GET is not allowed!");
47  }
48 
49  parent::offsetSet($offset, $value);
50  }
51 
52  public function offsetUnset(mixed $offset): void
53  {
54  throw new LogicException("Modifying global Request-Array such as \$_GET is not allowed!");
55  }
56 }
__construct(Factory $factory, array $raw_values, bool $throwOnValueAssignment=false)
Class SuperGlobalDropInReplacement This Class wraps SuperGlobals such as $_GET and $_POST to prevent ...
__construct(Container $dic, ilPlugin $plugin)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
kindlyTo()
Combined validations and transformations for primitive data types that establish a baseline for furth...
Definition: Factory.php:56