function __get($name) { $getProperty = 'get' . $name; if (in_array($getProperty, $this->properties)) { return $this->{$getProperty}(); } else { throw new Exception('Property ' . $name . ' does not exists.'); } }