This might be better implemented in several functions, rather than trying to wrap 3 separate calling conventions into 1 function with this use of an array. Or just use Request::url directly from calling functions. This is confusing and doesn't really save any repeat code.