<?php


namespace CMSMSExt\core;


class static_registry
{
  private static array $_data = [];
  
  public static function set($key, $value) : void
  {
    self::$_data[$key] = $value;
  }
  
  public static function get($key, $default = NULL)
  {
    return self::$_data[$key] ?? $default;
  }
  
  public static function has($key) : bool
  {
    return isset(self::$_data[$key]);
  }
  
  public static function remove($key) : void
  {
    if(self::has($key))
    {
      unset(self::$_data[$key]);
    }
  }
  
  public static function clear() : void
  {
    self::$_data = [];
  }
  
  public function __sleep()
  {
    return['_data'];
  }
}


?>