why not just $class instanceof ... ?