Skip to content

Commit

Permalink
Fixed lint errors in moodle-plugin-ci v4
Browse files Browse the repository at this point in the history
Updated copyright notice
  • Loading branch information
Vidalia committed May 21, 2024
1 parent 343d918 commit 55294df
Show file tree
Hide file tree
Showing 25 changed files with 102 additions and 104 deletions.
2 changes: 1 addition & 1 deletion amd/build/cards.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/cards.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/src/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @module format_cards/cards
* @class format_cards/cards
* @copyright 2023 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/backup_format_cards_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* Backs up courses that use the cards format. Ensures that card images are included in the backup
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/restore_format_cards_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Specialised restore logic for format_cards. Handles restoring images used for each card
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
2 changes: 1 addition & 1 deletion classes/courseformat/stateactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Contains the core course state actions specific to cards format.
*
* @package format_cards
* @copyright 2023 University of Essex
* @copyright 2024 University of Essex
* @author Ferran Recio <ferran@moodle.com>
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Expand Down
8 changes: 4 additions & 4 deletions classes/forms/editcard_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Moodle form for editing a section
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -40,7 +40,7 @@
* Moodle form for editing a section
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -52,7 +52,7 @@ class editcard_form extends editsection_form {
* @return void
* @throws coding_exception
*/
public function definition() {
public function definition(): void {
parent::definition();

$form = $this->_form;
Expand All @@ -68,7 +68,7 @@ public function definition() {
[
'subdirs' => 0,
'maxfiles' => 1,
'accepted_types' => [ 'web_image' ]
'accepted_types' => [ 'web_image' ],
]
);

Expand Down
13 changes: 7 additions & 6 deletions classes/output/courseformat/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Course content renderer
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -27,14 +27,14 @@

use coding_exception;
use format_topics\output\courseformat\content as content_base;
use moodle_exception;
use renderer_base;
use stdClass;

/**
* Course content renderer
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -56,7 +56,8 @@ public function get_template_name(renderer_base $renderer): string {
* Export template data
*
* @param renderer_base $output
* @return stdClass|object
* @return object
* @throws moodle_exception
*/
public function export_for_template(renderer_base $output) {
global $PAGE;
Expand Down Expand Up @@ -95,11 +96,11 @@ public function export_for_template(renderer_base $output) {
/**
* Adds section navigation data to the template
*
* @param stdClass|object $data Current template context
* @param object $data Current template context
* @param renderer_base $output Output renderer
* @return void $data is modified directly
*/
private function add_section_navigation(&$data, renderer_base $output) {
private function add_section_navigation(&$data, renderer_base $output): void {
$singlesection = $this->format->get_sectionnum();

if (!$singlesection) {
Expand Down
6 changes: 3 additions & 3 deletions classes/output/courseformat/content/cm.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Class for rendering a course module within the format
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -33,7 +33,7 @@
* Extended class for rendering a course module within the course
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -46,7 +46,7 @@ class cm extends cm_base {
* @param array $haspartials
* @param renderer_base $output
* @return bool
* @see \core_courseformat\output\local\content\cm::add_format_data
* @see cm_base::add_format_data
*/
protected function add_format_data(stdClass &$data, array $haspartials, renderer_base $output): bool {
$result = parent::add_format_data($data, $haspartials, $output);
Expand Down
16 changes: 9 additions & 7 deletions classes/output/courseformat/content/section.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Renders a course section
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -29,6 +29,7 @@
use core_courseformat\base as course_format;
use format_cards\output\courseformat\content\section\sectionbreak;
use format_topics\output\courseformat\content\section as section_base;
use moodle_exception;
use moodle_url;
use renderer_base;
use section_info;
Expand All @@ -38,7 +39,7 @@
* Renders a course section
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -47,7 +48,7 @@ class section extends section_base {
/**
* @var sectionbreak Section break renderer
*/
protected $sectionbreak;
protected sectionbreak $sectionbreak;

/**
* Section output constructor.
Expand All @@ -67,7 +68,7 @@ public function __construct(course_format $format, section_info $section) {
* @param renderer_base $renderer
* @return string
*/
public function get_template_name(\renderer_base $renderer): string {
public function get_template_name(renderer_base $renderer): string {
return $this->show_as_card()
? 'format_cards/local/content/section/card'
: 'format_cards/local/content/section';
Expand Down Expand Up @@ -239,7 +240,7 @@ private function get_section_completion(): array {
'iscomplete' => $iscomplete,
'hasprogress' => $completed > 0,
'showpercentage' => !$iscomplete && $progressformat == FORMAT_CARDS_PROGRESSFORMAT_PERCENTAGE,
'showcount' => !$iscomplete && $progressformat == FORMAT_CARDS_PROGRESSFORMAT_COUNT
'showcount' => !$iscomplete && $progressformat == FORMAT_CARDS_PROGRESSFORMAT_COUNT,
];
}

Expand All @@ -249,6 +250,7 @@ private function get_section_completion(): array {
* @param stdClass $data
* @param renderer_base $output
* @return void
* @throws moodle_exception
*/
private function add_section_break(stdClass $data, renderer_base $output): void {

Expand All @@ -264,9 +266,9 @@ private function add_section_break(stdClass $data, renderer_base $output): void
[
'courseid' => $this->section->course,
'sectionid' => $this->section->id,
'action' => 'add'
'action' => 'add',
]
))->out(false)
))->out(false),
];
}
}
Expand Down
9 changes: 4 additions & 5 deletions classes/output/courseformat/content/section/controlmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Overrides default control menu to modify the permalink
*
* @package format_cards
* @copyright 2023 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -30,7 +30,7 @@
* Section control menu class
*
* @package format_cards
* @copyright 2023 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
*/
class controlmenu extends base_controlmenu {
Expand All @@ -53,9 +53,8 @@ public function section_control_items(): array {
}

// Format base class already has a function to get the correct section URL.
$sectionlink = $this->format->get_view_url(
$this->section->section
);
$sectionlink = $this->format->get_view_url($this->section->section);

$controls['permalink'] = [
'url' => $sectionlink,
'icon' => 'i/link',
Expand Down
8 changes: 4 additions & 4 deletions classes/output/courseformat/content/section/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Renders a course section header
*
* @package format_cards
* @copyright 2023 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -39,7 +39,7 @@
* Renders a course section header
*
* @package format_cards
* @copyright 2023 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -50,7 +50,7 @@ class header extends header_base {
*
* @var stored_file[]
*/
private static $images = [];
private static array $images = [];

/**
* We don't want section titles to have clickable links
Expand Down Expand Up @@ -119,7 +119,7 @@ public function get_course_colour(): string {
// The colour palette is hardcoded for now. It would make sense to combine it with theme settings.
$basecolours = [
'#81ecec', '#74b9ff', '#a29bfe', '#dfe6e9', '#00b894',
'#0984e3', '#b2bec3', '#fdcb6e', '#fd79a8', '#6c5ce7'
'#0984e3', '#b2bec3', '#fdcb6e', '#fd79a8', '#6c5ce7',
];

return $basecolours[$this->format->get_course()->id % 10];
Expand Down
6 changes: 3 additions & 3 deletions classes/output/courseformat/content/section/sectionbreak.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Renders a section break.
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -42,7 +42,7 @@
* Renders a section break.
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down Expand Up @@ -145,7 +145,7 @@ public function export_for_template(renderer_base $output) {
[
'courseid' => $this->section->course,
'sectionid' => $this->section->id,
'action' => 'remove'
'action' => 'remove',
]
))->out(false);
return $data;
Expand Down
6 changes: 3 additions & 3 deletions classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* Course format renderer
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand All @@ -39,7 +39,7 @@ class renderer extends section_renderer {
* @param stdClass $course The course entry from DB
* @return string HTML to output.
*/
public function section_title($section, $course) {
public function section_title($section, $course): string {
return $this->render(course_get_format($course)->inplace_editable_render_section_name($section));
}

Expand All @@ -50,7 +50,7 @@ public function section_title($section, $course) {
* @param int|stdClass $course The course entry from DB
* @return string HTML to output.
*/
public function section_title_without_link($section, $course) {
public function section_title_without_link($section, $course): string {
return $this->render(course_get_format($course)->inplace_editable_render_section_name($section, false));
}

Expand Down
2 changes: 1 addition & 1 deletion classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* Privacy subsystem implementation for format_cards
*
* @package format_cards
* @copyright 2022 University of Essex
* @copyright 2024 University of Essex
* @author John Maydew <jdmayd@essex.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down

0 comments on commit 55294df

Please sign in to comment.