Skip to content

Commit bdfaffe

Browse files
committed
Fix local_codechecker complaints
1 parent de87dc1 commit bdfaffe

File tree

14 files changed

+82
-87
lines changed

14 files changed

+82
-87
lines changed

element/coursefield/lang/en/customcertelement_coursefield.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2424
*/
2525

26-
$string['pluginname'] = 'Course field';
27-
$string['privacy:metadata'] = 'The course field plugin does not store any personal data.';
2826
$string['coursefield'] = 'Course field';
2927
$string['coursefield_help'] = 'This is the course field that will be displayed on the PDF.';
28+
$string['pluginname'] = 'Course field';
29+
$string['privacy:metadata'] = 'The course field plugin does not store any personal data.';

element/coursename/lang/en/customcertelement_coursename.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@
2222
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2323
*/
2424

25+
$string['coursefullname'] = 'Full name';
2526
$string['coursenamedisplay'] = 'Type';
2627
$string['coursenamedisplay_help'] = 'Display the course full name or short name?';
27-
$string['coursefullname'] = 'Full name';
2828
$string['courseshortname'] = 'Short name';
2929
$string['pluginname'] = 'Course name';
3030
$string['privacy:metadata'] = 'The Course name plugin does not store any personal data.';
31-

element/date/lang/en/customcertelement_date.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,22 @@
2626
$string['courseenddate'] = 'Course end date';
2727
$string['coursegradedate'] = 'Course grade date';
2828
$string['coursestartdate'] = 'Course start date';
29-
$string['enrolmentenddate'] = 'Enrolment end date';
30-
$string['enrolmentstartdate'] = 'Enrolment start date';
31-
$string['expirydateone'] = 'Expiry date (1 year)';
32-
$string['expirydatetwo'] = 'Expiry date (2 year)';
33-
$string['expirydatethree'] = 'Expiry date (3 year)';
34-
$string['expirydatefour'] = 'Expiry date (4 year)';
35-
$string['expirydatefive'] = 'Expiry date (5 year)';
3629
$string['currentdate'] = 'Current date';
3730
$string['dateformat'] = 'Date format';
3831
$string['dateformat_help'] = 'This is the format of the date that will be displayed';
3932
$string['dateitem'] = 'Date item';
4033
$string['dateitem_help'] = 'This will be the date that is printed on the certificate';
34+
$string['enrolmentenddate'] = 'Enrolment end date';
35+
$string['enrolmentstartdate'] = 'Enrolment start date';
36+
$string['expirydatefive'] = 'Expiry date (5 year)';
37+
$string['expirydatefour'] = 'Expiry date (4 year)';
38+
$string['expirydateone'] = 'Expiry date (1 year)';
39+
$string['expirydatethree'] = 'Expiry date (3 year)';
40+
$string['expirydatetwo'] = 'Expiry date (2 year)';
4141
$string['issueddate'] = 'Issued date';
42-
$string['pluginname'] = 'Date';
43-
$string['privacy:metadata'] = 'The Date plugin does not store any personal data.';
4442
$string['numbersuffix_nd_as_in_second'] = 'nd';
4543
$string['numbersuffix_rd_as_in_third'] = 'rd';
4644
$string['numbersuffix_st_as_in_first'] = 'st';
45+
$string['pluginname'] = 'Date';
46+
$string['privacy:metadata'] = 'The Date plugin does not store any personal data.';
4747
$string['userdateformat'] = 'User date format';

element/daterange/tests/element_test.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* @copyright 2018 Dmitrii Metelkin <[email protected]>
4242
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
4343
*/
44-
class element_test extends advanced_testcase {
44+
final class element_test extends advanced_testcase {
4545

4646
/**
4747
* Helper function to build element data.
@@ -128,7 +128,7 @@ public static function get_test_get_daterange_string_for_recurring_ranges_data_p
128128
* @param string $date Date to test.
129129
* @param string $expected Expected result.
130130
*/
131-
public function test_get_daterange_string_for_recurring_ranges($date, $expected) {
131+
public function test_get_daterange_string_for_recurring_ranges($date, $expected): void {
132132
$dateranges = [
133133
(object)[
134134
'startdate' => strtotime('01.04.2017'),
@@ -154,7 +154,7 @@ public function test_get_daterange_string_for_recurring_ranges($date, $expected)
154154
*
155155
* @covers \element::get_daterange_string
156156
*/
157-
public function test_that_first_matched_range_applied_first() {
157+
public function test_that_first_matched_range_applied_first(): void {
158158
$dateranges = [
159159
(object)[
160160
'startdate' => strtotime('01.04.2017'),
@@ -180,7 +180,7 @@ public function test_that_first_matched_range_applied_first() {
180180
*
181181
* @covers \element::get_daterange_string
182182
*/
183-
public function test_placeholders_and_fall_back_string() {
183+
public function test_placeholders_and_fall_back_string(): void {
184184
$dateranges = [
185185
(object)[
186186
'startdate' => strtotime('01.04.2017'),
@@ -207,7 +207,7 @@ public function test_placeholders_and_fall_back_string() {
207207
*
208208
* @covers \element::get_daterange_string
209209
*/
210-
public function test_nothing_will_be_displayed_if_empty_fallback_string() {
210+
public function test_nothing_will_be_displayed_if_empty_fallback_string(): void {
211211
$dateranges = [
212212
(object)[
213213
'startdate' => strtotime('01.04.2017'),
@@ -229,7 +229,7 @@ public function test_nothing_will_be_displayed_if_empty_fallback_string() {
229229
*
230230
* @covers \element::get_daterange_string
231231
*/
232-
public function test_recurring_range_first_year_and_recurring_range_last_year_placeholders() {
232+
public function test_recurring_range_first_year_and_recurring_range_last_year_placeholders(): void {
233233
$datestring = '{{range_first_year}}-{{range_last_year}}-{{recurring_range_first_year}}-{{recurring_range_last_year}}';
234234
$dateranges = [
235235
(object) [

element/digitalsignature/lang/en/customcertelement_digitalsignature.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
$string['nosignature'] = 'No signature';
2727
$string['pluginname'] = 'Digital signature';
2828
$string['privacy:metadata'] = 'The Digital signature plugin does not store any personal data.';
29+
$string['signaturecontactinfo'] = 'Signature contact info';
30+
$string['signaturelocation'] = 'Signature location';
2931
$string['signaturename'] = 'Signature name';
3032
$string['signaturepassword'] = 'Signature password';
31-
$string['signaturelocation'] = 'Signature location';
3233
$string['signaturereason'] = 'Signature reason';
33-
$string['signaturecontactinfo'] = 'Signature contact info';
3434
$string['uploaddigitalsignature'] = 'Upload digital signature';

element/grade/lang/en/customcertelement_grade.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,13 @@
2323
*/
2424

2525
$string['coursegrade'] = 'Course grade';
26-
$string['gradeitem'] = 'Grade item';
27-
$string['gradeitem_help'] = 'The grade item you wish to display the grade of.';
2826
$string['gradeformat'] = 'Grade format';
2927
$string['gradeformat_help'] = 'The format you wish to use when displaying the grade.';
3028
$string['gradeitem'] = 'Grade item';
29+
$string['gradeitem_help'] = 'The grade item you wish to display the grade of.';
30+
$string['gradeletter'] = 'Letter';
3131
$string['gradepercent'] = 'Percentage';
3232
$string['gradepoints'] = 'Points';
33-
$string['gradeletter'] = 'Letter';
3433
$string['pluginname'] = 'Grade';
3534
$string['previewgrade'] = 'Preview grade';
3635
$string['privacy:metadata'] = 'The Grade plugin does not store any personal data.';

lang/en/customcert.php

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,20 @@
4141
$string['createtemplate'] = 'Create template';
4242
$string['customcert:addinstance'] = 'Add a new custom certificate instance';
4343
$string['customcert:manage'] = 'Manage a custom certificate';
44+
$string['customcert:manageemailothers'] = 'Manage email others setting';
4445
$string['customcert:manageemailstudents'] = 'Manage email students setting';
4546
$string['customcert:manageemailteachers'] = 'Manage email teachers setting';
46-
$string['customcert:manageemailothers'] = 'Manage email others setting';
47-
$string['customcert:manageverifyany'] = 'Manage verification setting';
48-
$string['customcert:managerequiredtime'] = 'Manage time required setting';
47+
$string['customcert:managelanguages'] = 'Manage language on edit form';
4948
$string['customcert:manageprotection'] = 'Manage protection setting';
49+
$string['customcert:managerequiredtime'] = 'Manage time required setting';
50+
$string['customcert:manageverifyany'] = 'Manage verification setting';
5051
$string['customcert:receiveissue'] = 'Receive a certificate';
51-
$string['customcert:view'] = 'View a custom certificate';
52-
$string['customcert:viewreport'] = 'View course report';
53-
$string['customcert:viewallcertificates'] = 'View all certificates';
5452
$string['customcert:verifyallcertificates'] = 'Verify all certificates on the site';
5553
$string['customcert:verifycertificate'] = 'Verify a certificate';
54+
$string['customcert:view'] = 'View a custom certificate';
55+
$string['customcert:viewallcertificates'] = 'View all certificates';
56+
$string['customcert:viewreport'] = 'View course report';
5657
$string['customcertsettings'] = 'Custom certificate settings';
57-
$string['downloadallissuedcertificates'] = 'Download all issued certificates';
58-
$string['downloadallsitecertificates'] = 'Download all site certificates';
59-
$string['downloadallsitecertificatesdesc'] = 'This will download all the certificates on the site in a zip file.';
6058
$string['deletecertpage'] = 'Delete page';
6159
$string['deleteconfirm'] = 'Delete confirmation';
6260
$string['deleteelement'] = 'Delete element';
@@ -69,6 +67,9 @@
6967
$string['deliveryoptioninline'] = 'Send the file inline to the browser';
7068
$string['deliveryoptions'] = 'Delivery options';
7169
$string['description'] = 'Description';
70+
$string['downloadallissuedcertificates'] = 'Download all issued certificates';
71+
$string['downloadallsitecertificates'] = 'Download all site certificates';
72+
$string['downloadallsitecertificatesdesc'] = 'This will download all the certificates on the site in a zip file.';
7273
$string['duplicate'] = 'Duplicate';
7374
$string['duplicateconfirm'] = 'Duplicate confirmation';
7475
$string['duplicatetemplateconfirm'] = 'Are you sure you want to duplicate this certificate template?';
@@ -91,17 +92,17 @@
9192
$string['emailnonstudentcertificatelinktext'] = 'View certificate report';
9293
$string['emailnonstudentgreeting'] = 'Hi';
9394
$string['emailnonstudentsubject'] = '{$a->coursefullname}: {$a->certificatename}';
95+
$string['emailothers'] = 'Email others';
96+
$string['emailothers_help'] = 'If set this will email the email addresses listed here (separated by a comma) with a copy of the certificate when it becomes available. <strong>Warning:</strong> Setting this field before you have finished creating the certificate will email the addresses an incomplete certificate.';
9497
$string['emailstudentbody'] = 'Attached is your certificate \'{$a->certificatename}\' for the course \'{$a->coursefullname}\'.';
9598
$string['emailstudentbodyplaintext'] = 'Attached is your certificate \'{$a->certificatename}\' for the course \'{$a->coursefullname}\'.';
9699
$string['emailstudentcertificatelinktext'] = 'View certificate';
97100
$string['emailstudentgreeting'] = 'Dear {$a}';
98-
$string['emailstudentsubject'] = '{$a->coursefullname}: {$a->certificatename}';
99101
$string['emailstudents'] = 'Email students';
100102
$string['emailstudents_help'] = 'If set this will email the students a copy of the certificate when it becomes available. <strong>Warning:</strong> Setting this to \'Yes\' before you have finished creating the certificate will email the student an incomplete certificate.';
103+
$string['emailstudentsubject'] = '{$a->coursefullname}: {$a->certificatename}';
101104
$string['emailteachers'] = 'Email teachers';
102105
$string['emailteachers_help'] = 'If set this will email the teachers a copy of the certificate when it becomes available. <strong>Warning:</strong> Setting this to \'Yes\' before you have finished creating the certificate will email the teacher an incomplete certificate.';
103-
$string['emailothers'] = 'Email others';
104-
$string['emailothers_help'] = 'If set this will email the email addresses listed here (separated by a comma) with a copy of the certificate when it becomes available. <strong>Warning:</strong> Setting this field before you have finished creating the certificate will email the addresses an incomplete certificate.';
105106
$string['eventelementcreated'] = 'Custom certificate element created';
106107
$string['eventelementdeleted'] = 'Custom certificate element deleted';
107108
$string['eventelementupdated'] = 'Custom certificate element updated';
@@ -127,11 +128,12 @@
127128
$string['invalidelementwidthorheightnotnumber'] = 'Please enter a valid number.';
128129
$string['invalidelementwidthorheightzeroallowed'] = 'Please enter a number greater than or equal to 0.';
129130
$string['invalidelementwidthorheightzeronotallowed'] = 'Please enter a number greater than 0.';
130-
$string['invalidposition'] = 'Please select a positive number for position {$a}.';
131131
$string['invalidheight'] = 'The height has to be a valid number greater than 0.';
132132
$string['invalidmargin'] = 'The margin has to be a valid number greater than 0.';
133+
$string['invalidposition'] = 'Please select a positive number for position {$a}.';
133134
$string['invalidwidth'] = 'The width has to be a valid number greater than 0.';
134135
$string['landscape'] = 'Landscape';
136+
$string['languageoptions'] = 'Force Certificate Language';
135137
$string['leftmargin'] = 'Left margin';
136138
$string['leftmargin_help'] = 'This is the left margin of the certificate PDF in mm.';
137139
$string['listofissues'] = 'Recipients: {$a}';
@@ -142,9 +144,9 @@
142144
$string['managetemplatesdesc'] = 'This link will take you to a new screen where you will be able to manage templates used by Custom certificate activities in courses.';
143145
$string['modify'] = 'Modify';
144146
$string['modulename'] = 'Custom certificate';
145-
$string['modulenameplural'] = 'Custom certificates';
146147
$string['modulename_help'] = 'This module allows for the dynamic generation of PDF certificates.';
147148
$string['modulename_link'] = 'Custom_certificate_module';
149+
$string['modulenameplural'] = 'Custom certificates';
148150
$string['mycertificates'] = 'My certificates';
149151
$string['mycertificatesdescription'] = 'These are the certificates you have been issued by either email or downloading manually.';
150152
$string['name'] = 'Name';
@@ -166,10 +168,10 @@
166168
$string['posy_help'] = 'This is the position in mm from the top left corner you wish the element\'s reference point to locate in the y direction.';
167169
$string['preventcopy'] = 'Prevent copy';
168170
$string['preventcopy_desc'] = 'Enable protection from copy action.';
169-
$string['preventprint'] = 'Prevent print';
170-
$string['preventprint_desc'] = 'Enable protection from print action.';
171171
$string['preventmodify'] = 'Prevent modify';
172172
$string['preventmodify_desc'] = 'Enable protection from modify action.';
173+
$string['preventprint'] = 'Prevent print';
174+
$string['preventprint_desc'] = 'Enable protection from print action.';
173175
$string['print'] = 'Print';
174176
$string['privacy:metadata:customcert_issues'] = 'The list of issued certificates';
175177
$string['privacy:metadata:customcert_issues:code'] = 'The code that belongs to the certificate';
@@ -187,9 +189,9 @@
187189
$string['rightmargin'] = 'Right margin';
188190
$string['rightmargin_help'] = 'This is the right margin of the certificate PDF in mm.';
189191
$string['save'] = 'Save';
190-
$string['savechanges'] = 'Save changes';
191192
$string['saveandclose'] = 'Save and close';
192193
$string['saveandcontinue'] = 'Save and continue';
194+
$string['savechanges'] = 'Save changes';
193195
$string['savechangespreview'] = 'Save changes and preview';
194196
$string['savetemplate'] = 'Save template';
195197
$string['search:activity'] = 'Custom certificate - activity information';
@@ -211,22 +213,17 @@
211213
$string['uploadimage'] = 'Upload image';
212214
$string['uploadimagedesc'] = 'This link will take you to a new screen where you will be able to upload images. Images uploaded using
213215
this method will be available throughout your site to all users who are able to create a certificate.';
216+
$string['userlanguage'] = 'Use user preferences';
217+
$string['userlanguage_help'] = 'You can force the language of the certificate to override the user\'s language preferences.';
214218
$string['verified'] = 'Verified';
215219
$string['verify'] = 'Verify';
216220
$string['verifyallcertificates'] = 'Allow verification of all certificates';
217221
$string['verifyallcertificates_desc'] = 'When this setting is enabled any person (including users not logged in) can visit the link \'{$a}\' in order to verify any certificate on the site, rather than having to go to the verification link for each certificate.
218222
219223
Note - this only applies to certificates where \'Allow anyone to verify a certificate\' has been set to \'Yes\' in the certificate settings.';
220224
$string['verifycertificate'] = 'Verify certificate';
221-
$string['verifycertificatedesc'] = 'This link will take you to a new screen where you will be able to verify certificates on the site';
222225
$string['verifycertificateanyone'] = 'Allow anyone to verify a certificate';
223226
$string['verifycertificateanyone_help'] = 'This setting enables anyone with the certificate verification link (including users not logged in) to verify a certificate.';
227+
$string['verifycertificatedesc'] = 'This link will take you to a new screen where you will be able to verify certificates on the site';
224228
$string['width'] = 'Width';
225229
$string['width_help'] = 'This is the width of the certificate PDF in mm. For reference an A4 piece of paper is 210mm wide and a letter is 216mm wide.';
226-
227-
$string['userlanguage'] = 'Use user preferences';
228-
$string['languageoptions'] = 'Force Certificate Language';
229-
$string['userlanguage_help'] = 'You can force the language of the certificate to override the user\'s language preferences.';
230-
231-
// Acess API.
232-
$string['customcert:managelanguages'] = 'Manage language on edit form';

tests/element_helper_test.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* @copyright 2017 Mark Nelson <[email protected]>
4040
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
4141
*/
42-
class element_helper_test extends advanced_testcase {
42+
final class element_helper_test extends advanced_testcase {
4343

4444
/**
4545
* Test set up.
@@ -53,7 +53,7 @@ public function setUp(): void {
5353
*
5454
* @covers \element_helper::get_courseid
5555
*/
56-
public function test_get_courseid_element_in_course_certificate() {
56+
public function test_get_courseid_element_in_course_certificate(): void {
5757
global $DB;
5858

5959
// Create a course.
@@ -87,7 +87,7 @@ public function test_get_courseid_element_in_course_certificate() {
8787
*
8888
* @covers \element_helper::get_courseid
8989
*/
90-
public function test_get_courseid_element_in_site_template() {
90+
public function test_get_courseid_element_in_site_template(): void {
9191
global $DB, $SITE;
9292

9393
// Add a template to the site.
@@ -114,7 +114,7 @@ public function test_get_courseid_element_in_site_template() {
114114
*
115115
* @covers \element_helper::get_context
116116
*/
117-
public function test_get_context_element_in_course_certificate() {
117+
public function test_get_context_element_in_course_certificate(): void {
118118
global $DB;
119119

120120
// Create a course.
@@ -149,7 +149,7 @@ public function test_get_context_element_in_course_certificate() {
149149
*
150150
* @covers \element_helper::get_context
151151
*/
152-
public function test_get_context_element_in_site_template() {
152+
public function test_get_context_element_in_site_template(): void {
153153
global $DB;
154154

155155
// Add a template to the site.
@@ -176,7 +176,7 @@ public function test_get_context_element_in_site_template() {
176176
*
177177
* @covers \element_helper::get_grade_items
178178
*/
179-
public function test_get_grade_items() {
179+
public function test_get_grade_items(): void {
180180
global $DB;
181181

182182
// Create a course.
@@ -219,7 +219,7 @@ public function test_get_grade_items() {
219219
*
220220
* @covers \element_helper::get_mod_grade_info
221221
*/
222-
public function test_get_mod_grade_info() {
222+
public function test_get_mod_grade_info(): void {
223223
// Create a course.
224224
$course = $this->getDataGenerator()->create_course();
225225

@@ -290,7 +290,7 @@ public function test_get_mod_grade_info() {
290290
*
291291
* @covers \element_helper::get_course_grade_info
292292
*/
293-
public function test_get_course_grade_info() {
293+
public function test_get_course_grade_info(): void {
294294
// Create a course.
295295
$course = $this->getDataGenerator()->create_course();
296296

@@ -352,7 +352,7 @@ public function test_get_course_grade_info() {
352352
*
353353
* @covers \element_helper::get_grade_item_info
354354
*/
355-
public function test_get_grade_item_info() {
355+
public function test_get_grade_item_info(): void {
356356
// Create a course.
357357
$course = $this->getDataGenerator()->create_course();
358358

0 commit comments

Comments
 (0)