public function loadExtraOptions($extraOptions, $instance)
{
foreach ($extraOptions as $name => $value) {
if ($this->reflected->hasMethod($name)) {
// There is a method to handle this option
call_user_func_array(array($instance, $name), is_array($value) ? $value : array($value));
continue;
}
if ($this->reflected->hasProperty($name) && $this->reflected->getProperty($name)->isPublic()) {
// There is a public member we can set for this option
$instance->{$name} = $value;
continue;
}
if ($this->canHandle($name)) {
// There is a custom handler for that option
$closure = $this->getExtraOptionsHandler($name);
$closure($instance, $value);
}
}
}