jeudi 9 juin 2016

Apply design pattern to url with different paramters

I have a one type of url that their parameters might have different values. Example: http://ift.tt/1PKzhVf

if ($location === 'country') {
 //countries will be loaded from database
} else if ($location === ''province") {
//province will be loaded from database
} else if ($location === ''neighborhood") {
//neighborhood will be loaded from database
}

the url has more type of parameters that apply the same logic.

What design pattern I should apply to this logic?

Aucun commentaire:

Enregistrer un commentaire