ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SafeStorage.php
Go to the documentation of this file.
1<?php
2
3namespace League\Flysystem;
4
5final class SafeStorage
6{
10 private $hash;
11
15 protected static $safeStorage = [];
16
17 public function __construct()
18 {
19 $this->hash = spl_object_hash($this);
20 static::$safeStorage[$this->hash] = [];
21 }
22
23 public function storeSafely($key, $value)
24 {
25 static::$safeStorage[$this->hash][$key] = $value;
26 }
27
28 public function retrieveSafely($key)
29 {
30 if (array_key_exists($key, static::$safeStorage[$this->hash])) {
31 return static::$safeStorage[$this->hash][$key];
32 }
33 }
34
35 public function __destruct()
36 {
37 unset(static::$safeStorage[$this->hash]);
38 }
39}
An exception for terminatinating execution or to throw for unit testing.
$key
Definition: croninfo.php:18
hash(StreamInterface $stream, $algo, $rawOutput=false)
Calculate a hash of a Stream.
Definition: functions.php:406