12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- abstract class Base {
- private $data;
- public function __construct(){
- $this->data = [];
- // Constructor
- }
- public function __clone(){
- // Clone handler
- }
- public function __destruct(){
- // Destroy handler
- $this->data = [];
- }
- public function __toString(){
- $name = get_class($this);
- if(!$name){
- $name = "Object";
- }
- return "[".$name."]";
- }
- public function __invoke($res,$args){
- // Invoke handler
- }
- public function jsonSerialize(){
- return $this;
- }
- public function __get($name){
- return $this->data??null;
- }
- public function __set($name,$value){
- if(isset($this->data[$name])){
- $this->data[$name] = $value;
- }
- }
- public function __isset($name){
- return isset($this->data[$name]);
- }
- public function __unset($name){
- unset($this->data[$name]);
- }
- }
- ?>
|