ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
RenamingDIC.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
28class RenamingDIC implements \ArrayAccess
29{
30 protected int $counter = 0;
31
32 public function __construct(
33 protected \ArrayAccess $wrapped
34 ) {
35 }
36
37 public function offsetSet($id, $value): void
38 {
39 $id = "{$id}_{$this->counter}";
40 $this->counter++;
41 $this->wrapped->offsetSet($id, $value);
42 }
43
44 public function offsetGet($id): mixed
45 {
46 return $this->wrapped->offsetGet($id);
47 }
48
49 public function offsetExists($id): bool
50 {
51 return $this->wrapped->offsetExists($id);
52 }
53
54 public function offsetUnset($id): void
55 {
56 $this->wrapped->offsetUnset($id);
57 }
58}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
A wrapper around another DIC that superficially adds a _# and passes them to an underlying DIC.
Definition: RenamingDIC.php:29
__construct(protected \ArrayAccess $wrapped)
Definition: RenamingDIC.php:32