public function __set($name, $data)
{
if (in_array($name, $this->_properties)) {
$setfn = 'set' . ucfirst($name);
if (method_exists($this, $setfn)) {
//makes it possible to cast argument value type for an explicitly defined setter methods
$this->{$setfn}($data);
} else {
$this->propertiesData[$name] = $data;
}
} else {
throw new \InvalidArgumentException(sprintf('Unknown property "%s" for the object %s', $name, get_class($this)));
}
}