MemberCenter.php 587 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\common\modules\member;
  3. class MemberCenter
  4. {
  5. static $current;
  6. private $data;
  7. public function __construct()
  8. {
  9. static::$current = $this;
  10. }
  11. static public function current()
  12. {
  13. if(!isset(self::$current)){
  14. return new static();
  15. }
  16. return self::$current;
  17. }
  18. public function set($key,$value)
  19. {
  20. return $this->data[$key] = $value;
  21. }
  22. public function get($key)
  23. {
  24. return $this->data[$key];
  25. }
  26. public function all()
  27. {
  28. return $this->data;
  29. }
  30. }