The $appid variable name seems to be a leftover. $isEnabled would be better. Even better would be try/catch :)