I have a very long switch statement with more than 18 cases. I want to make it more comfortable and easier for the maintenance, but I have no idea how ...
switch($key)
{
case 'male':
return $filter = array($gender , '=', 'male');
break;
case 'female':
return $filter = array($gender , '=', 'female');
break;
case '10':
return $filter = array($lookingFor, $like, '%Mann%');
break;
case '11':
return $filter = array($lookingFor, $like, '%Frau%');
break;
case '12':
return $filter = array($lookingFor, $like, '%Paar%');
break;
case '13':
return $filter = array($lookingFor, $like, '%Herren/-in%');
break;
case '14':
return $filter = array($lookingFor, $like, '%Sklave/-in%');
break;
case '15':
return $filter = array($lookingFor, $like, '%Domina%');
break;
case '20':
return $filter = array($lookFor , $like, '%Affäre%');
break;
case '21':
return $filter = array($lookFor , $like, '%Cybersex%');
break;
case '22':
return $filter = array($lookFor , $like, '%Ehe%');
break;
case '23':
return $filter = array($lookFor , $like, '%Flirt%');
break;
case '24':
return $filter = array($lookFor , $like, '%Freundschaft%');
break;
case '25':
return $filter = array($lookFor , $like, '%für alles offen%');
break;
case '26':
return $filter = array($lookFor , $like, '%Partnerschaft%');
break;
case '27':
return $filter = array($lookFor , $like, '%Sex%');
break;
case 'default':
default:
return $filter = array('is_old', '=', '0');
break;
}
I'm very grateful for every hint or idea.