Refactor isEmpty a bit and add isEntitled

This will be used in Wikibase\EntityContent.