ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
SetProbe.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
25class SetProbe implements \ArrayAccess
26{
27 public function __construct(
28 protected $probe
29 ) {
30 if (!is_callable($probe)) {
31 throw new \InvalidArgumentException(
32 "Expected \$probe to be callable."
33 );
34 }
35 }
36
37 public function offsetExists($offset): bool
38 {
39 return false;
40 }
41
42 public function offsetGet($offset): mixed
43 {
44 throw new \LogicException(
45 "Write-only dependency type used for reading."
46 );
47 }
48
49 public function offsetSet($offset, $value): void
50 {
51 $probe = $this->probe;
52 $probe($offset, $value);
53 }
54
55 public function offsetUnset($offset): void
56 {
57 }
58}