ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
SuperGlobalDropInReplacement.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\HTTP\Wrapper;
22
25use LogicException;
26use OutOfBoundsException;
27
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}
Builds data types.
Definition: Factory.php:36
Class SuperGlobalDropInReplacement This Class wraps SuperGlobals such as $_GET and $_POST to prevent ...
__construct(Factory $factory, array $raw_values, private bool $throwOnValueAssignment=false)
kindlyTo()
Combined validations and transformations for primitive data types that establish a baseline for furth...
Definition: Factory.php:55
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc