From aeb8e5fcff5971211d79f9b4ae00b609a88aa212 Mon Sep 17 00:00:00 2001 From: Irina Hoppe Date: Fri, 24 May 2024 13:35:34 +0200 Subject: [PATCH] some more codestyle fixes --- backup/moodle2/backup_restore_helper.php | 6 ++++ ...ore_ratingallocate_activity_task.class.php | 4 ++- classes/allocations_table.php | 4 ++- classes/choice_importer.php | 8 +++++- classes/ratingallocate_observer.php | 4 ++- classes/ratings_and_allocations_table.php | 8 +++++- .../task/send_distribution_notification.php | 4 ++- db/db_structure.php | 28 ++++++++++++++----- db/uninstall.php | 6 +++- solver/edmonds-karp.php | 8 +++++- solver/ford-fulkerson-koegel.php | 6 +++- solver/solver-template.php | 6 +++- strategy/strategy01_yes_no.php | 4 +-- strategy/strategy02_yes_maybe_no.php | 8 ++++-- strategy/strategy03_lickert.php | 5 ++-- strategy/strategy04_points.php | 4 +-- strategy/strategy05_order.php | 4 ++- strategy/strategy06_tickyes.php | 2 +- strategy/strategy_template_options.php | 2 +- tests/generator/lib.php | 2 ++ tests/mod_generator_test.php | 2 +- .../mod_ratingallocate_choice_groups_test.php | 2 ++ .../mod_ratingallocate_notification_test.php | 2 +- tests/mod_ratingallocate_status_test.php | 4 +-- 24 files changed, 101 insertions(+), 32 deletions(-) diff --git a/backup/moodle2/backup_restore_helper.php b/backup/moodle2/backup_restore_helper.php index b2267a4f..30b65c5a 100644 --- a/backup/moodle2/backup_restore_helper.php +++ b/backup/moodle2/backup_restore_helper.php @@ -24,6 +24,8 @@ */ /** + * Get fields for tableclass + * * @param $class * @return array * @throws ReflectionException @@ -41,6 +43,8 @@ function get_fields_for_tableclass($class) { } /** + * Get tablename for tableclass. + * * @param $class * @return mixed * @throws ReflectionException @@ -52,6 +56,8 @@ function get_tablename_for_tableclass($class) { } /** + * Get id for tableclass. + * * @param $class * @return array * @throws ReflectionException diff --git a/backup/moodle2/restore_ratingallocate_activity_task.class.php b/backup/moodle2/restore_ratingallocate_activity_task.class.php index 1a82f154..3a36cf24 100644 --- a/backup/moodle2/restore_ratingallocate_activity_task.class.php +++ b/backup/moodle2/restore_ratingallocate_activity_task.class.php @@ -28,7 +28,9 @@ require_once($CFG->dirroot . '/mod/ratingallocate/backup/moodle2/restore_ratingallocate_activity_stepslib.php'); /** - * @class restore_ratingallocate_activity_task + * Restore ratingallocate activity class + * + * @package mod_ratingallocate * @copyright 214 C. Usener * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ diff --git a/classes/allocations_table.php b/classes/allocations_table.php index 4a96b0e2..541ef96b 100644 --- a/classes/allocations_table.php +++ b/classes/allocations_table.php @@ -30,7 +30,9 @@ require_once($CFG->dirroot . '/user/lib.php'); /** - * @class allocations_table + * Allocations table. + * + * @package mod_ratingallocate */ class allocations_table extends \table_sql { diff --git a/classes/choice_importer.php b/classes/choice_importer.php index c1e51fb5..772e79e2 100644 --- a/classes/choice_importer.php +++ b/classes/choice_importer.php @@ -15,6 +15,8 @@ // along with Moodle. If not, see . /** + * Choice importer. + * * @package mod_ratingallocate * @copyright 2021 Catalyst IT * @author David Thompson @@ -28,7 +30,9 @@ require_once($CFG->libdir . '/csvlib.class.php'); /** - * @class choice_importer + * Choice importer. + * + * @package mod_ratingallocate */ class choice_importer { /** @@ -76,6 +80,8 @@ public static function print_fields($fields=self::REQUIRED_FIELDS) { } /** + * Construct. + * * @param $ratingallocateid * @param $ratingallocate */ diff --git a/classes/ratingallocate_observer.php b/classes/ratingallocate_observer.php index 6ae72054..489e8e2b 100644 --- a/classes/ratingallocate_observer.php +++ b/classes/ratingallocate_observer.php @@ -27,7 +27,9 @@ use dml_exception; /** - * @class ratingallocate_observer + * Ratingallocate observer. + * + * @package mod_ratingallocate */ class ratingallocate_observer { diff --git a/classes/ratings_and_allocations_table.php b/classes/ratings_and_allocations_table.php index 5ca101b8..585f74a8 100644 --- a/classes/ratings_and_allocations_table.php +++ b/classes/ratings_and_allocations_table.php @@ -30,7 +30,9 @@ require_once($CFG->libdir . '/tablelib.php'); /** - * @class ratings_and_allocations_table + * Ratings and allocations table + * + * @package mod_ratingallocate */ class ratings_and_allocations_table extends \table_sql { @@ -89,6 +91,8 @@ class ratings_and_allocations_table extends \table_sql { private $renderer; /** + * Construct. + * * @param \mod_ratingallocate_renderer $renderer * @param $titles * @param $ratingallocate @@ -651,6 +655,8 @@ function($u) { } /** + * Filter choiceids. + * * @param $choiceids * @return array * @throws \dml_exception diff --git a/classes/task/send_distribution_notification.php b/classes/task/send_distribution_notification.php index c7e6d9ba..6ebff9f0 100644 --- a/classes/task/send_distribution_notification.php +++ b/classes/task/send_distribution_notification.php @@ -31,7 +31,9 @@ use ratingallocate\db as this_db; /** - * @class send_distibution_notification + * Send distribution notification + * + * @package mod_ratingallocate */ class send_distribution_notification extends \core\task\adhoc_task { // Gets executed by the task runner. Will lookup the ratingallocation object and diff --git a/db/db_structure.php b/db/db_structure.php index 4f248015..c545b79d 100644 --- a/db/db_structure.php +++ b/db/db_structure.php @@ -28,7 +28,9 @@ defined('MOODLE_INTERNAL') || die(); /** - * @class ratingallocate + * Ratingallocate. + * + * @package mod_ratingallocate */ class ratingallocate { /** @@ -106,7 +108,9 @@ class ratingallocate { } /** - * @class Ratingallocate choices + * Ratingallocate choices. + * + * @package mod_ratingallocate */ class ratingallocate_choices { /** @@ -144,7 +148,9 @@ class ratingallocate_choices { } /** - * @class ratingallocate_group_choices + * Ratingallocate group choices. + * + * @package mod_ratingallocate */ class ratingallocate_group_choices { /** @@ -166,7 +172,9 @@ class ratingallocate_group_choices { } /** - * @class ratingallocate_ch_gengroups + * Ratingallocate generated groups of choices + * + * @package mod_ratingallocate */ class ratingallocate_ch_gengroups { /** @@ -188,7 +196,9 @@ class ratingallocate_ch_gengroups { } /** - * @class ratingallocate_groupings Generated grouping by instance + * Ratingallocate groupings + * + * @package mod_ratingallocate */ class ratingallocate_groupings { /** @@ -210,7 +220,9 @@ class ratingallocate_groupings { } /** - * @class ratings (map user to choice) + * Ratingallocate ratings + * + * @package mod_ratingallocate */ class ratingallocate_ratings { /** @@ -236,7 +248,9 @@ class ratingallocate_ratings { } /** - * @class allocations + * Ratingallocate allocations. + * + * @package mod_ratingallocate */ class ratingallocate_allocations { /** diff --git a/db/uninstall.php b/db/uninstall.php index 7f69a2ad..d9bdf5e4 100644 --- a/db/uninstall.php +++ b/db/uninstall.php @@ -15,6 +15,8 @@ // along with Moodle. If not, see . /** + * Db uninstall. + * * @see uninstall_plugin() * * @package mod_ratingallocate @@ -23,7 +25,9 @@ */ /** - * @function uninstall Custom uninstallation procedure + * Uninstall. + * + * @package mod_ratingallocate */ function xmldb_ratingallocate_uninstall() { return true; diff --git a/solver/edmonds-karp.php b/solver/edmonds-karp.php index 3247ef34..05a2f012 100644 --- a/solver/edmonds-karp.php +++ b/solver/edmonds-karp.php @@ -29,11 +29,15 @@ require_once(dirname(__FILE__) . '/solver-template.php'); /** - * @class solver_edmonds_karp + * Solver edmonds-karp. + * + * @package mod_ratingallocate */ class solver_edmonds_karp extends distributor { /** + * Return name. + * * @return string */ public function get_name() { @@ -41,6 +45,8 @@ public function get_name() { } /** + * Compute distribution. + * * @param $choicerecords * @param $ratings * @param $usercount diff --git a/solver/ford-fulkerson-koegel.php b/solver/ford-fulkerson-koegel.php index 2d77858a..fce4b315 100644 --- a/solver/ford-fulkerson-koegel.php +++ b/solver/ford-fulkerson-koegel.php @@ -31,7 +31,9 @@ require_once(dirname(__FILE__) . '/solver-template.php'); /** - * @class solver_ford_fulkerson + * Solver Ford-fulkerson. + * + * @package mod_ratingallocate */ class solver_ford_fulkerson extends distributor { @@ -156,6 +158,8 @@ public function find_shortest_path_bellmanf_koegel($from, $to) { } /** + * Return name. + * * @return string */ public function get_name() { diff --git a/solver/solver-template.php b/solver/solver-template.php index 85e09f90..42f24141 100644 --- a/solver/solver-template.php +++ b/solver/solver-template.php @@ -33,7 +33,9 @@ defined('MOODLE_INTERNAL') || die(); /** - * @class edge + * Edge. + * + * @package mod_ratingallocate */ class edge { /** @var from int */ @@ -46,6 +48,8 @@ class edge { public $space; /** + * Construct. + * * @param $from * @param $to * @param $weight diff --git a/strategy/strategy01_yes_no.php b/strategy/strategy01_yes_no.php index ab34342d..d9f966fc 100644 --- a/strategy/strategy01_yes_no.php +++ b/strategy/strategy01_yes_no.php @@ -36,7 +36,7 @@ /** * Strategy * - * @class strategy + * @package mod_ratingallocate */ class strategy extends \strategytemplate_options { @@ -106,7 +106,7 @@ protected function getvalidationinfo() { /** * View form * - * @class mod_ratingallocate_view_form + * @package mod_ratingallocate */ class mod_ratingallocate_view_form extends \ratingallocate_options_strategyform { // Already specified by parent class. diff --git a/strategy/strategy02_yes_maybe_no.php b/strategy/strategy02_yes_maybe_no.php index 399b0542..f059641f 100644 --- a/strategy/strategy02_yes_maybe_no.php +++ b/strategy/strategy02_yes_maybe_no.php @@ -35,7 +35,9 @@ require_once(dirname(__FILE__) . '/strategy_template_options.php'); /** - * @class strategy + * Strategy. + * + * @package mod_ratingallocate */ class strategy extends \strategytemplate_options { @@ -126,7 +128,9 @@ protected function getvalidationinfo() { \strategymanager::add_strategy(strategy::STRATEGYID); /** - * @class mod_ratingallocate_view_form + * View form. + * + * @package mod_ratingallocate */ class mod_ratingallocate_view_form extends \ratingallocate_options_strategyform { // Already specified by parent class. diff --git a/strategy/strategy03_lickert.php b/strategy/strategy03_lickert.php index d80bb789..850133fe 100644 --- a/strategy/strategy03_lickert.php +++ b/strategy/strategy03_lickert.php @@ -35,7 +35,8 @@ /** * Strategy - * @class strategy + * + * @package mod_ratingallocate */ class strategy extends \strategytemplate_options { @@ -153,7 +154,7 @@ protected function getvalidationinfo() { /** * View form. * - * @class mod_ratinallocate_view_form + * @package mod_ratingallocate */ class mod_ratingallocate_view_form extends \ratingallocate_options_strategyform { // Already specified by parent class. diff --git a/strategy/strategy04_points.php b/strategy/strategy04_points.php index 730d11b4..592a9f25 100644 --- a/strategy/strategy04_points.php +++ b/strategy/strategy04_points.php @@ -37,7 +37,7 @@ /** * Strategy * - * @class strategy + * @package mod_ratingallocate */ class strategy extends \strategytemplate { @@ -112,7 +112,7 @@ protected function getvalidationinfo() { /** * View form. * - * @class mod_ratingallocate_view_form + * @package mod_ratingallocate */ class mod_ratingallocate_view_form extends \ratingallocate_strategyform { diff --git a/strategy/strategy05_order.php b/strategy/strategy05_order.php index 04fdfc39..c129e041 100644 --- a/strategy/strategy05_order.php +++ b/strategy/strategy05_order.php @@ -34,7 +34,9 @@ require_once(dirname(__FILE__) . '/strategy_template.php'); /** - * @class strategy + * Strategy. + * + * @package mod_ratingallocate */ class strategy extends \strategytemplate { diff --git a/strategy/strategy06_tickyes.php b/strategy/strategy06_tickyes.php index 83fcc10a..6afa49cd 100644 --- a/strategy/strategy06_tickyes.php +++ b/strategy/strategy06_tickyes.php @@ -37,7 +37,7 @@ /** * Strategy. * - * @class strategy + * @package mod_ratingallocate */ class strategy extends \strategytemplate { diff --git a/strategy/strategy_template_options.php b/strategy/strategy_template_options.php index 5d2a2b7b..d97f1773 100644 --- a/strategy/strategy_template_options.php +++ b/strategy/strategy_template_options.php @@ -33,7 +33,7 @@ /** * Strategytemplate options. * - * @class strategytemplate_options + * @package mod_ratingallocate */ abstract class strategytemplate_options extends \strategytemplate { diff --git a/tests/generator/lib.php b/tests/generator/lib.php index f3b53f10..f95ff2f0 100644 --- a/tests/generator/lib.php +++ b/tests/generator/lib.php @@ -18,6 +18,8 @@ * Library for Tests * * @package mod_ratingallocate + * @copyright usener + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); diff --git a/tests/mod_generator_test.php b/tests/mod_generator_test.php index 40d6669a..771882d9 100644 --- a/tests/mod_generator_test.php +++ b/tests/mod_generator_test.php @@ -42,7 +42,7 @@ public function test_create_instance() { // There should not be any module for that course first. $this->assertFalse( - $DB->record_exists('ratingallocate',['course' => $course->id, + $DB->record_exists('ratingallocate', ['course' => $course->id, ])); $records = $DB->get_records('ratingallocate_choices', [], 'id'); $this->assertEquals(0, count($records)); diff --git a/tests/mod_ratingallocate_choice_groups_test.php b/tests/mod_ratingallocate_choice_groups_test.php index 3b7399f7..72c7599b 100644 --- a/tests/mod_ratingallocate_choice_groups_test.php +++ b/tests/mod_ratingallocate_choice_groups_test.php @@ -227,6 +227,8 @@ public function test_choice_groups() { } /** + * Test update choice groups. + * * @return void * @covers ::update_choice_groups */ diff --git a/tests/mod_ratingallocate_notification_test.php b/tests/mod_ratingallocate_notification_test.php index 30501047..fde1547a 100644 --- a/tests/mod_ratingallocate_notification_test.php +++ b/tests/mod_ratingallocate_notification_test.php @@ -90,7 +90,7 @@ public function test_allocation_notification() { 'choice' => self::CHOICE2, 'rating' => 0, ], - ] + ], ]; $ratingallocate = \mod_ratingallocate_generator::get_closed_ratingallocate_for_teacher($this, $choices, diff --git a/tests/mod_ratingallocate_status_test.php b/tests/mod_ratingallocate_status_test.php index 0ffc3ded..8b4fab17 100644 --- a/tests/mod_ratingallocate_status_test.php +++ b/tests/mod_ratingallocate_status_test.php @@ -41,9 +41,9 @@ public function setUp(): void { } /** - * Provider. + * Provider * - * @return array|Iterable|Generator the different testing scenarios. + * @return array[] */ public function ratingallocate_provider() { return [