ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilForumNotificationCache.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
28 private array $storage = [];
29
33 public function fetch(string $id)
34 {
35 if (!$this->exists($id)) {
36 throw new InvalidArgumentException('Storage id doesn\'t exist');
37 }
38
39 return $this->storage[$id];
40 }
41
45 public function store(string $key, $data): void
46 {
47 $this->storage[$key] = $data;
48 }
49
50 public function exists(string $id): bool
51 {
52 return array_key_exists($id, $this->storage);
53 }
54
58 public function createKeyByValues(array $values): string
59 {
60 foreach ($values as &$value) {
61 if ($value !== null && !is_scalar($value)) {
62 throw new InvalidArgumentException(sprintf(
63 "Value %s is not scalar and can't be used to build a key",
64 print_r($value, true)
65 ));
66 }
67
68 $value = (string) $value;
69 }
70
71 return md5(implode('|', $values));
72 }
73}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Class ilForumNotificationCache.