versionable/Ferret — pull request #8 by simensen (2012-12-13 15:13:46+00:00)
Title: Rewrite DetectorInterface API, added Metadata

Here is a good start on where I'd like to take Ferret. This will not be BC with existing Ferret API.

I have a couple of projects depending on this so I really need to know if this is going to work for you or not. I would like for us to decide pretty quickly if I should continue working with Ferret or if I should start rolling my own solution.

Changes in this PR:

* Detector interface accepts a resource and a Metadata object, both optional (allows for detectors based on streams and or arbitrary things like content-type headers)
* Renamed "getMimeType" method on Ferret to "detectFromFilename"
* Removed MIMETypes Detector entirely
* Updated tests to ensure they still work

Changes I'd make next:

* Integrate with a Media Types package, specifically [this one](https://github.com/webignition/internet-media-type)
* Remove the notion of FerretInterface. I think that having Ferret being a facade will mean having a lot of methods and thus probably not needed to provide alternate implementations.
* Remove the `equals` and `hash` methods from Detector interface. They currently do not work (all implementations currently return the same hash, the class `Versionable\Ferret\Detector\DetectorAbstract` since `__CLASS__` is specific to the class in the file in which `__CLASS__` is referenced, not the actual class of the instance.
* Integrate with my Apache MIME Types library for Pathinfo Detector ([here](https://github.com/dflydev/dflydev-apache-mime-types))

*It is a little messy looking because it includes the stuff from #5. I will rebase this PR as soon as #5 is merged.*