File: vendor/league/flysystem/src/SafeStorage.php

Recommend this page to a friend!
  Classes of Renato De Oliveira Lucena  >  PHP Pokemon Script  >  vendor/league/flysystem/src/SafeStorage.php  >  Download  
File: vendor/league/flysystem/src/SafeStorage.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Pokemon Script
Provides an API to manage a database of Pokemons
Author: By
Last change:
Date: 2 years ago
Size: 744 bytes
 

Contents

Class file image Download
<?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]);
    }
}


For more information send a message to info at phpclasses dot org.