Perhaps [Simon is right with the comment](https://codereview.stackexchange.com/questions/191756/parse-a-clean-slug-url#comment369671_191756): >_FWIW I think you should just use input parameters, it's not like anyone is going to type this out._ But if you don't agree with that, then perhaps the simplification below will help. ###Possible simplification One consideration I had was to use a regular expression with named groups - something like this: preg_match('#-?((?P<keywords>[^-]+)-)?((?P<employmentTypes>[^-]+)-)?(?P<location>.+)#', $parameters, $matches); Which works well for the case where all three parameters are supplied - e.g. `"-engineer~c++-full_time-canada~paris"`: Array ( [keywords] => engineer~c++ [employmentTypes] => full_time [location] => canada~paris ) However if either keywords or employment types are omitted, there would still need to be logic to determine which of those is still present... So perhaps it would be better to give more generic names for the first two - like `groupA` and `groupB`... preg_match('#-?((?P<groupA>[^-]+)-)?((?P<groupB>[^-]+)-)?(?P<location>.+)#', $parameters, $matches); And you would still need the logic to determine if `groupA` had keywords or employment types... but at least you should likely be able to simplify assignment of the locations parameter. ###Simplifying the `array_map()` call The call to `array_map()` in `areEmploymentTypes()`: > $jobTypes = array_map(function ($v) { return mb_strtolower($v); }, $this->allEmploymentTypes); Can be simplified by simply passing the function name `mb_strtolower` as a string literal: $jobTypes = array_map('mb_strtolower', $allEmploymentTypes);