/** * the constructor * * @param $data an assoc array with the object informations */ public function __construct($data = array()) { if ($data === null) { $data = array(); } foreach ($data as $key => $value) { if (isset($key)) { if ($key == 'body' && is_object($value)) { $this->{$key} = Reference::decodeReference($value, false); } else { $func = 'set' . strtoupper($key[0]) . substr($key, 1); $methodVariable = array($this, $func); if (is_callable($methodVariable)) { $this->{$func}($value); } else { $this->{$key} = $value; } } } } }