base.abstract.class.php 853 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Juju;
  3. abstract class Base {
  4. private $data;
  5. public function __construct(){
  6. $this->data = [];
  7. // Constructor
  8. }
  9. public function __clone(){
  10. // Clone handler
  11. }
  12. public function __destruct(){
  13. // Destroy handler
  14. $this->data = [];
  15. }
  16. public function __toString(){
  17. $name = get_class($this);
  18. if(!$name){
  19. $name = "Object";
  20. }
  21. return "[".$name."]";
  22. }
  23. public function __invoke($res,$args){
  24. // Invoke handler
  25. }
  26. public function jsonSerialize(){
  27. return $this;
  28. }
  29. public function __get($name){
  30. return $this->data??null;
  31. }
  32. public function __set($name,$value){
  33. if(isset($this->data[$name])){
  34. $this->data[$name] = $value;
  35. }
  36. }
  37. public function __isset($name){
  38. return isset($this->data[$name]);
  39. }
  40. public function __unset($name){
  41. unset($this->data[$name]);
  42. }
  43. }
  44. ?>