private function setProperties(User $user, array $values) { foreach ($this->setters as $property => $setter) { if (array_key_exists($property, $values)) { $user->{$setter}($values[$property]); } } }