Improved PHP class snippet