public function __construct($json) { $util = InstanceHolder::util(); if ($util->is_json($json)) { $std = json_decode($json); parent::__construct($std); $this->json_error = json_last_error(); $this->json_error_msg = json_last_error_msg(); } else { $std = new \stdClass(); parent::__construct($std); } }
public function __toObject() { $ob = new AccessibleObject(); foreach ($this as $key => $value) { $ob->set($key, $value); } return $ob; }