Make a mapping of all available options to their validation function. I wrapped the standard functions as example for own functions.
public function edit($id, $title, $options, $raw) {
$isString = function($value) {
return is_string($value);
};
$isArray = function($value) {
return is_array($value);
};
$avaiableOptions = array(
'placeholderTitleDate' => $isString,
'optionsBottomSelect' => $isArray,
...
);
foreach ($options as $key => $val) {
if (!array_key_exists($key, $availableOptions) {
echo ... no such option - typo? available options are: ...
} else {
$validationFunc = $availableOptions[$key];
if (!$validationFunc($options[$key])) {
echo ... invalid value for option $key
}
}
}