added a phpdoc and applied code formatting