Better code analysis of methods to see when they are empty

Fixes #492
you can remove this condition. When the token is an array, there is always an index 0 and an index 1 in the data returned by ``token_get_all`` (and you don't check the index 1 a few lines above)