I have an internal application in which one function is containing too many switch cases.
This is developed in php.This specific function is used to write changes to database and also to keep a history of individual field values. So what it does is have a case for each field as different things needs to be applied for different fields.
switch ($item){
case 'item1':
do_something();
case 'item2':
do_something_different():
}
Is there a design pattern to follow in such cases. A function for each item doesn't look so future proof either.
Update: pastebin link
Thanks.