in reply to OO style question: how much information to hide?
Taking the latter form to extremes, you could end up writing something like
$token->del_attr('font') if $token->is_start_tag and $token->can_have_attr('font') and $token->has_attr('font');
If the method can only be applied if certain condition(s) are true, better to have the test(s) once in the object and know that they will be performed, than to force every caller to perform the tests, and risk that they don't.
|
|---|