Added phpdoc and tests