I have a class with a single static factory method:
class WidgetFactory
{
function create( $widget )
{
if( condition )
{
//create and return new Widget
//of appropriate type
}
else
{
trigger_error( 'message' );
return null;
}
}
}
The error isn't being thrown, eg:
$widget =& WidgetFactory::create( 'foo' );
should trigger an error because 'foo' is not a valid argument. Instead of getting the error, I just get $widget == null.
If I call create() as an instance method it works like I want it to:
$factory =& new WidgetFactory();
$widget =& $factory -> create( 'foo' );
//throws a nice error : )
But I want to call create() statically because that's the kinda person I am. :p
What did I miss/do wrong?
TIA,
-jazz_snob