Hey,
Interesting idea. A few suggestions:
* Having static methods to access this is nice and convenient, but perhaps we can make a singleton with instance methods such as hasFeature and static methods such as "has" that then just do "return self::singleton()->hasFeature()"
* Having an array with string keys seems way more flexible and extendible then having static (or even non-static) members. It'd be pretty bad if the system did not allow for extensions to register present features.
How about Feature? I was thinking something like:
Feature::required( "Foo" ) -- for a hard fail if the feature doesn't exist Feature::desired( "Foo" ) -- for conditional behavior if a feature exists
+1, although I'd tweak the names a bit:
* Feature::require( 'foo' ) - throws an error or whatever when not present * Feature::has( 'cheesburger' ) - returns a boolean
The first name is still not ideal though. I'd expect "required" to return a boolean. But then again, "require" can be interpreted as loading the feature.
Cheers
-- Jeroen De Dauw http://www.bn2vs.com Don't panic. Don't be evil. --