Removed unnecessary PHP close tags.
Fixed some incorrect PHPDocs and unused variables.
Follow PSR-1 and PSR-2 coding style.