From 9b4780745c951de00c52709f534dc07e48596e36 Mon Sep 17 00:00:00 2001 From: Renaat Debleu Date: Mon, 9 Oct 2023 11:57:55 +0000 Subject: [PATCH] code review --- classes/privacy/provider.php | 2 +- format.php | 6 +++--- lib.php | 16 ++++++++-------- tests/masonry_test.php | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index fd6bd27..83d4cda 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -25,7 +25,7 @@ namespace format_masonry\privacy; -use \core_privacy\local\metadata\null_provider; +use core_privacy\local\metadata\null_provider; /** * Privacy main class. diff --git a/format.php b/format.php index 9c95e38..f304ba0 100644 --- a/format.php +++ b/format.php @@ -53,13 +53,13 @@ 'itemSelector' => '.section.main', 'columnWidth' => 1, 'isRTL' => right_to_left(), - 'gutterWidth' => 0 - ]], + 'gutterWidth' => 0, + ], ], false, [ 'name' => 'course_format_masonry', 'fullpath' => '/course/format/masonry/format.js', - 'requires' => ['base', 'node', 'transition', 'event', 'io-base', 'moodle-core-io'] + 'requires' => ['base', 'node', 'transition', 'event', 'io-base', 'moodle-core-io'], ] ); } diff --git a/lib.php b/lib.php index 8713f21..28ba400 100644 --- a/lib.php +++ b/lib.php @@ -120,7 +120,7 @@ public function section_format_options($foreditform = false) { 'cache' => true, 'cachedefault' => $color, 'help' => 'colordisplay', - 'help_component' => 'format_masonry']]; + 'help_component' => 'format_masonry', ], ]; } /** @@ -139,7 +139,7 @@ public function course_format_options($foreditform = false) { 'coursedisplay' => ['type' => PARAM_INT, 'default' => 1], 'borderwidth' => ['type' => PARAM_INT, 'default' => 1], 'bordercolor' => ['type' => PARAM_TEXT, 'default' => '#F0F0F0'], - 'backcolor' => ['type' => PARAM_TEXT, 'default' => '#F0F0F0']]; + 'backcolor' => ['type' => PARAM_TEXT, 'default' => '#F0F0F0'], ]; } if ($foreditform && !isset($courseformatoptions['coursedisplay']['label'])) { $courseconfig = get_config('moodlecourse'); @@ -152,29 +152,29 @@ public function course_format_options($foreditform = false) { 'numsections' => [ 'label' => new \lang_string('numberweeks'), 'element_type' => 'select', - 'element_attributes' => [$sectionmenu]], + 'element_attributes' => [$sectionmenu], ], 'hiddensections' => [ 'label' => 'hidden1', 'element_type' => 'hidden', - 'element_attributes' => [[1 => new \lang_string('hiddensectionsinvisible')]]], + 'element_attributes' => [[1 => new \lang_string('hiddensectionsinvisible')]], ], 'coursedisplay' => [ 'label' => 'hidden2', 'element_type' => 'hidden', - 'element_attributes' => [[COURSE_DISPLAY_SINGLEPAGE => new \lang_string('coursedisplay_single')]]], + 'element_attributes' => [[COURSE_DISPLAY_SINGLEPAGE => new \lang_string('coursedisplay_single')]], ], 'borderwidth' => [ 'label' => new \lang_string('borderwidth', 'format_masonry'), 'element_type' => 'select', - 'element_attributes' => [[0 => '0', 1 => '1', 2 => '2']]], + 'element_attributes' => [[0 => '0', 1 => '1', 2 => '2']], ], 'bordercolor' => [ 'label' => new \lang_string('bordercolor', 'format_masonry'), 'element_type' => 'text', - 'element_type' => 'hidden'], + 'element_type' => 'hidden', ], 'backcolor' => [ 'label' => new \lang_string('bordercolor', 'format_masonry'), 'element_type' => 'text', 'help' => 'colordisplay', 'help_component' => 'format_masonry', - 'element_attributes' => [['value' => $courseformatoptions['bordercolor']['default']]]]]; + 'element_attributes' => [['value' => $courseformatoptions['bordercolor']['default']]], ], ]; $courseformatoptions = array_merge_recursive($courseformatoptions, $courseoptionsedit); } return $courseformatoptions; diff --git a/tests/masonry_test.php b/tests/masonry_test.php index 9b89b7a..5c72b53 100644 --- a/tests/masonry_test.php +++ b/tests/masonry_test.php @@ -53,7 +53,7 @@ public function setUp(): void { $CFG->enableavailability = true; $gen = $this->getDataGenerator(); $params = ['format' => 'masonry', 'numsections' => 6, 'startdate' => time() - 3000, - 'enablecompletion' => 1, 'showactivitydates' => true]; + 'enablecompletion' => 1, 'showactivitydates' => true, ]; $course = $gen->create_course($params, ['createsections' => true]); $DB->set_field('course', 'groupmode', SEPARATEGROUPS); $DB->set_field('course', 'groupmodeforce', 1); @@ -137,7 +137,7 @@ public function test_default_course_enddate() { 'category' => $category, 'editoroptions' => [ 'context' => context_course::instance($this->course->id), - 'subdirs' => 0 + 'subdirs' => 0, ], 'returnto' => new \moodle_url('/'), 'returnurl' => new \moodle_url('/'), @@ -175,10 +175,10 @@ public function test_renderer() { $page->set_url('/course/view.php?id=' . $this->course->id); $PAGE->set_url('/course/view.php?id=' . $this->course->id); $page->requires->js_init_call('M.masonry.init', [[ - 'node' => '#coursemasonry', 'itemSelector' => '.section.main', 'columnWidth' => 1, 'isRTL' => right_to_left()]], + 'node' => '#coursemasonry', 'itemSelector' => '.section.main', 'columnWidth' => 1, 'isRTL' => right_to_left(), ], ], false, ['name' => 'course_format_masonry', 'fullpath' => '/course/format/masonry/format.js', - 'requires' => ['base', 'node', 'transition', 'event', 'io-base', 'moodle-core-io']]); + 'requires' => ['base', 'node', 'transition', 'event', 'io-base', 'moodle-core-io'], ]); $renderer = new \format_masonry\output\renderer($PAGE, null); $modinfo = get_fast_modinfo($this->course); $section = $modinfo->get_section_info(1);