From https://raw.github.com/codybonney/snippets/master/php/basic_class.php