base.abstract.class.php 835 B

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