# wpide/3.5.9/vendor/league/flysystem/src/SafeStorage.php

WPIDE – File Manager &amp; Code Editor, version 3.5.9. 40 lines.

- Page: https://pluginprobe.com/plugins/wpide/3.5.9/code/vendor/league/flysystem/src/SafeStorage.php
- Raw: https://pluginprobe.com/plugins/wpide/3.5.9/raw/vendor/league/flysystem/src/SafeStorage.php
- Modified: 2022-07-30T20:33:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wpide/3.5.9/code/vendor/league/flysystem/src/SafeStorage.php#L10-L20`.

```php
<?php

namespace League\Flysystem;

final class SafeStorage
{
    /**
     * @var string
     */
    private $hash;

    /**
     * @var array
     */
    protected static $safeStorage = [];

    public function __construct()
    {
        $this->hash = spl_object_hash($this);
        static::$safeStorage[$this->hash] = [];
    }

    public function storeSafely($key, $value)
    {
        static::$safeStorage[$this->hash][$key] = $value;
    }

    public function retrieveSafely($key)
    {
        if (array_key_exists($key, static::$safeStorage[$this->hash])) {
            return static::$safeStorage[$this->hash][$key];
        }
    }

    public function __destruct()
    {
        unset(static::$safeStorage[$this->hash]);
    }
}

```
