Wikia/app — pull request #5676 by drsnyder (2014-12-08 23:52:38+00:00)
Title: Add UrlGenerator Interface

https://wikia-inc.atlassian.net/browse/PLATFORM-634

Move the `GlobalFile`/`File` specific logic to those classes. Rely on the `getUrlGenerator` interface to fetch the `UrlGenerator` from those objects respectively instead of in `VignetteRequest`.

Why make this change? The logic of generating the `UrlGenerator` is specific to `File` and `GlobalFile` and not `VignetteRequest`. If something changes about the data used to generate the image url from those classes changes would have to be made both in those classes and in `VignetteRequest`. I think it's better to isolate those changes locally to the file objects.

After getting into this, I discovered that there are instances of `File` and `GlobalFile` confusion in `ImageServing`. Here is one [example](https://github.com/Wikia/app/blob/dev/extensions/wikia/ImageServing/imageServing.class.php#L280) where an `instanceof` is used to see if the parameter passed to `getUrl` is a `File`, `GlobalFile` or a string. Ideally that function would accept one "thing" that has a type. This suggests that there may be some unification between these two things that's missing.

/cc @nmonterroso @adamkarminski @macbre