name = $name; $this -> data = $data; } function __get($key) { if ($key == 'name') return $this -> name; elseif ($key == 'data') return $this -> data; elseif (is_array($this -> data) && array_key_exists($key, $this -> data)) return $this -> data[$key]; return null; } public function jsonSerialize() { return array ( 'name' => $this -> name, 'data' => $this -> data, ); } } # vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab