I'd move the `is_int` test before setting `$limit`. *If* there is a *limit* parameter, we check *if* it is an integer. *If* it is *not*, we thrown an exception. Then, when we're past that, we can set the variable.