Skip to content

Commit

Permalink
Moodle PHPDoc Checker fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed Aug 21, 2024
1 parent ef05f96 commit a86a36a
Show file tree
Hide file tree
Showing 22 changed files with 341 additions and 222 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/moodle-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ jobs:

- name: Moodle Code Checker
if: ${{ always() }}
run: moodle-plugin-ci phpcs --max-warnings 0 || true
run: moodle-plugin-ci phpcs --max-warnings 0

- name: Moodle PHPDoc Checker
if: ${{ always() }}
run: moodle-plugin-ci phpdoc || true
run: moodle-plugin-ci phpdoc

- name: Validating
if: ${{ always() }}
Expand Down
12 changes: 12 additions & 0 deletions backup/moodle2/restore_plagiarism_turnitin_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ protected function define_course_plugin_structure() {
* Restore the Turnitin course
* This will only be done this if the course is from the same site it was backed up from
* and if the Turnitin course id does not currently exist in the database.
*
* @param array $data The data to be restored
* @return void
* @throws dml_exception
*/
public function process_turnitin_course($data) {
global $DB;
Expand Down Expand Up @@ -72,6 +76,10 @@ protected function define_module_plugin_structure() {
* Restore the Turnitin assignment id for this module
* This will only be done this if the module is from the same site it was backed up from
* and if the Turnitin assignment id does not currently exist in the database.
*
* @param array $data The data to be restored
* @return void
* @throws dml_exception
*/
public function process_turnitin_config($data) {
global $DB;
Expand All @@ -98,6 +106,10 @@ public function process_turnitin_config($data) {
* Restore the links to Turnitin files.
* This will only be done this if the module is from the same site it was backed up from
* and if the Turnitin submission does not currently exist in the database.
*
* @param array $data The data to be restored
* @return void
* @throws dml_exception
*/
public function process_turnitin_files($data) {
global $DB;
Expand Down
2 changes: 2 additions & 0 deletions classes/digitalreceipt/pp_receipt_message.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class pp_receipt_message {
/**
* Send digital receipt to submitter
*
* @param int $userid
* @param string $message
* @param int $courseid
* @return void
*/
public function send_message($userid, $message, $courseid) {
Expand Down
2 changes: 2 additions & 0 deletions classes/forms/turnitin_setupform.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ public function display() {

/**
* Save the plugin config data
*
* @param stdClass $data
*/
public function save($data) {
global $CFG;
Expand Down
54 changes: 29 additions & 25 deletions classes/modules/turnitin_assign.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct() {
/**
* Check whether the user is a tutor
*
* @param $context
* @param context $context The context
* @return bool
* @throws coding_exception
*/
Expand All @@ -68,22 +68,10 @@ public function get_tutor_capability() {
return 'mod/'.$this->modname.':grade';
}

/**
* Whether the user is enrolled on the course and has the capability to submit assignments
*
* @param $context
* @param $userid
* @return bool
* @throws coding_exception
*/
public function user_enrolled_on_course($context, $userid) {
return has_capability('mod/'.$this->modname.':submit', $context, $userid);
}

/**
* Get the author of the submission
*
* @param $itemid
* @param int $itemid The item id
* @return int
* @throws dml_exception
*/
Expand All @@ -97,11 +85,23 @@ public function get_author($itemid) {
}
}

/**
* Whether the user is enrolled on the course and has the capability to submit assignments
*
* @param context $context The context
* @param int $userid The user id
* @return bool
* @throws coding_exception
*/
public function user_enrolled_on_course($context, $userid) {
return has_capability('mod/'.$this->modname.':submit', $context, $userid);
}

/**
* Set the content of the submission
*
* @param $linkarray
* @param $cm
* @param array $linkarray The link array
* @param object $cm The course module.
* @return string
*/
public function set_content($linkarray, $cm) {
Expand All @@ -114,7 +114,11 @@ public function set_content($linkarray, $cm) {
/**
* Check if resubmissions in a Turnitin sense are allowed to an assignment.
*
* @param $assignid
* @param int $assignid The assignment id
* @param int $reportgenspeed The report generation speed
* @param string $submissiontype The submission type
* @param int $attemptreopenmethod The attempt reopen method
* @param string $attemptreopened The attempt reopened status
*/
public function is_resubmission_allowed($assignid, $reportgenspeed, $submissiontype, $attemptreopenmethod,
$attemptreopened = null) {
Expand Down Expand Up @@ -150,8 +154,8 @@ public function is_resubmission_allowed($assignid, $reportgenspeed, $submissiont
/**
* Get the onlinetext submission
*
* @param $userid
* @param $cm
* @param int $userid The user id
* @param object $cm The course module.
* @return stdClass
* @throws dml_exception
*/
Expand Down Expand Up @@ -181,7 +185,7 @@ public function get_onlinetext($userid, $cm) {
/**
* Create a file event
*
* @param $params
* @param array $params The params
* @return \core\event\base
* @throws coding_exception
*/
Expand All @@ -192,7 +196,7 @@ public function create_file_event($params) {
/**
* Create a text event
*
* @param $params
* @param array $params The params
* @return \core\event\base
* @throws coding_exception
*/
Expand All @@ -203,9 +207,9 @@ public function create_text_event($params) {
/**
* Get the current grade query
*
* @param $userid
* @param $moduleid
* @param $itemid
* @param int $userid The user id
* @param int $moduleid The module id
* @param int $itemid The item id
* @return false|mixed
* @throws dml_exception
*/
Expand All @@ -222,7 +226,7 @@ public function get_current_gradequery($userid, $moduleid, $itemid = 0) {
/**
* Initialise the post date for the module
*
* @param $moduledata
* @param stdClass $moduledata The module data
* @return int
*/
public function initialise_post_date($moduledata) {
Expand Down
18 changes: 9 additions & 9 deletions classes/modules/turnitin_coursework.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct() {
/**
* Check whether the user is a tutor
*
* @param $context
* @param context $context The context
* @return bool
*/
public function is_tutor($context) {
Expand All @@ -72,8 +72,8 @@ public function get_tutor_capability() {
/**
* Whether the user is enrolled on the course and has the capability to submit coursework
*
* @param $context
* @param $userid
* @param context $context The context
* @param int $userid The user id
* @return bool
* @throws coding_exception
*/
Expand All @@ -84,7 +84,7 @@ public function user_enrolled_on_course($context, $userid) {
/**
* Get the author of the submission
*
* @param $itemid
* @param int $itemid The item id
* @return int
* @throws dml_exception
*/
Expand All @@ -103,7 +103,7 @@ public function get_author($itemid) {
/**
* Create a file event
*
* @param $params
* @param array $params The params
* @return mixed
*/
public function create_file_event($params) {
Expand All @@ -113,9 +113,9 @@ public function create_file_event($params) {
/**
* Get the current grade query
*
* @param $userid
* @param $moduleid
* @param $itemid
* @param int $userid The user id
* @param int $moduleid The module id
* @param int $itemid The item id
* @return false|mixed
* @throws dml_exception
*/
Expand All @@ -140,7 +140,7 @@ public function get_current_gradequery($userid, $moduleid, $itemid = 0) {
/**
* Initialise the post date for the module
*
* @param $moduledata
* @param stdClass $moduledata The module data
* @return int
*/
public function initialise_post_date($moduledata) {
Expand Down
22 changes: 11 additions & 11 deletions classes/modules/turnitin_forum.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct() {
/**
* Check whether the user is a tutor
*
* @param $context
* @param context $context The context
* @return bool
* @throws coding_exception
*/
Expand All @@ -71,8 +71,8 @@ public function get_tutor_capability() {
/**
* Whether the user is enrolled on the course and has the capability to reply to posts
*
* @param $context
* @param $userid
* @param context $context The context
* @param int $userid The user id
* @return bool
* @throws coding_exception
*/
Expand All @@ -83,7 +83,7 @@ public function user_enrolled_on_course($context, $userid) {
/**
* Get the author of the forum post
*
* @param $itemid
* @param int $itemid The item id
* @return void
*/
public function get_author($itemid = 0) {
Expand All @@ -93,7 +93,7 @@ public function get_author($itemid = 0) {
/**
* Set the content of the forum post
*
* @param $linkarray
* @param array $linkarray The link array
* @return mixed
* @throws dml_exception
*/
Expand All @@ -111,7 +111,7 @@ public function set_content($linkarray) {
/**
* Create a file event
*
* @param $params
* @param array $params The params
* @return \core\event\base
* @throws coding_exception
*/
Expand All @@ -122,9 +122,9 @@ public function create_file_event($params) {
/**
* Get the current grade query
*
* @param $userid
* @param $moduleid
* @param $itemid
* @param int $userid The user id
* @param int $moduleid The module id
* @param int $itemid The item id
* @return false|mixed|stdClass
* @throws dml_exception
*/
Expand All @@ -138,7 +138,7 @@ public function get_current_gradequery($userid, $moduleid, $itemid = 0) {
/**
* Initialise the post date for the module
*
* @param $moduledata
* @param stdClass $moduledata The module data
* @return int
*/
public function initialise_post_date($moduledata) {
Expand All @@ -150,7 +150,7 @@ public function initialise_post_date($moduledata) {
/**
* Get the forum discussion id
*
* @param $forumdata
* @param string $forumdata The forum data
* @return string
*/
public function get_discussionid($forumdata) {
Expand Down
Loading

0 comments on commit a86a36a

Please sign in to comment.