public function fromArray(array $values) { foreach ($values as $attribute => $value) { if (property_exists($this, $attribute)) { $attribute = \Helper\Text::sanitizeAttributeName($attribute); $this->{$attribute} = $value; } else { $this->foreignAttributes[$attribute] = $value; } } }