diff --git a/auth.php b/auth.php index ba08639..e05f7f5 100644 --- a/auth.php +++ b/auth.php @@ -107,7 +107,7 @@ class auth_plugin_userkey extends auth_plugin_base { /** * Redirects the user to provided URL. * - * @param $url URL to redirect to. + * @param string $url URL to redirect to. * * @throws \moodle_exception If gets running via CLI or AJAX call. */ @@ -134,8 +134,6 @@ class auth_plugin_userkey extends auth_plugin_base { /** * Logs a user in using userkey and redirects after. * - * @TODO: refactor this method to make it easy to read. - * * @throws \moodle_exception If something went wrong. */ public function user_login_userkey() { diff --git a/classes/core_userkey_manager.php b/classes/core_userkey_manager.php index c39a42f..83e7c0b 100644 --- a/classes/core_userkey_manager.php +++ b/classes/core_userkey_manager.php @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +namespace auth_userkey; + /** * Key manager class. * @@ -21,9 +23,6 @@ * @copyright 2016 Dmitrii Metelkin (dmitriim@catalyst-au.net) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - -namespace auth_userkey; - class core_userkey_manager implements userkey_manager_interface { /** diff --git a/db/upgrade.php b/db/upgrade.php index efb5a5b..70c844b 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -22,6 +22,12 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +/** + * Upgrade hook. + * + * @param string $oldversion Old version of the plugin. + * @return bool + */ function xmldb_auth_userkey_upgrade($oldversion) { global $DB; diff --git a/externallib.php b/externallib.php index f264197..a25bb94 100644 --- a/externallib.php +++ b/externallib.php @@ -28,6 +28,13 @@ require_once($CFG->libdir . "/externallib.php"); require_once($CFG->dirroot . "/webservice/lib.php"); require_once($CFG->dirroot . "/auth/userkey/auth.php"); +/** + * Webservices for auth_userkey. + * + * @package auth_userkey + * @copyright 2016 Dmitrii Metelkin (dmitriim@catalyst-au.net) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class auth_userkey_external extends external_api { /** diff --git a/tests/phpunit/externallib_test.php b/tests/phpunit/externallib_test.php index 5ace499..28aa256 100644 --- a/tests/phpunit/externallib_test.php +++ b/tests/phpunit/externallib_test.php @@ -21,7 +21,6 @@ * @copyright 2016 Dmitrii Metelkin (dmitriim@catalyst-au.net) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - class auth_userkey_externallib_testcase extends advanced_testcase { /** * User object. diff --git a/tests/phpunit/fake_userkey_manager.php b/tests/phpunit/fake_userkey_manager.php index 3120be7..5c554c2 100644 --- a/tests/phpunit/fake_userkey_manager.php +++ b/tests/phpunit/fake_userkey_manager.php @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +namespace auth_userkey; + /** * Fake userkey manager for testing. * @@ -21,20 +23,35 @@ * @copyright 2016 Dmitrii Metelkin (dmitriim@catalyst-au.net) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - -namespace auth_userkey; - class fake_userkey_manager implements userkey_manager_interface { + /** + * Create key. + * + * @param int $userid user ID. + * @param null $allowedips Allowed IPs. + * + * @return string + */ public function create_key($userid, $allowedips = null) { return 'FaKeKeyFoRtEsTiNg'; } + /** + * Delete keys for a user. + * + * @param int $userid User ID to delete keys for. + */ public function delete_keys($userid) { - // TODO: Implement delete_keys() method. } + /** + * Validate provided key. + * + * @param string $keyvalue Key to validate. + * + * @return object|void + */ public function validate_key($keyvalue) { - // TODO: Implement validate_key() method. } }