Guest User

Untitled

a guest
May 27th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. <?php
  2.  
  3. class Registry {
  4. protected static $data = array();
  5.  
  6. // this is a static class
  7. final private function __construct()
  8. {
  9.  
  10. }
  11.  
  12. public static function set($key, $value)
  13. {
  14. self::$data[$key] = $value;
  15. }
  16.  
  17. public static function get($key, $default = NULL)
  18. {
  19. if (isset(self::$data[$key])) {
  20. return self::$data[$key];
  21. } else {
  22. return $default;
  23. }
  24. }
  25. }
Add Comment
Please, Sign In to add comment