public function __get($field)
{
if (!array_key_exists($field, $this->exposed) && !in_array($field, $this->exposed)) {
throw new UnknownFieldException('Field ' . $field . ' does not exist');
}
if (method_exists($this, 'get' . ucfirst($field))) {
return call_user_func([$this, 'get' . ucfirst($field)]);
}
return $this->extract(isset($this->exposed[$field]) ? $this->exposed[$field] : $field);
}