Skip to content

Commit f82bb05

Browse files
committed
Linting fixes with phpcbf
1 parent 8c417ff commit f82bb05

21 files changed

+417
-237
lines changed

backup/moodle2/backup_qtype_aitext_plugin.class.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3131
*/
3232
class backup_qtype_aitext_plugin extends backup_qtype_plugin {
33-
3433
/**
3534
* returns the name of the plugin/question type
3635
*
@@ -71,12 +70,16 @@ protected function define_question_plugin_structure() {
7170
$pluginwrapper->add_child($aitext);
7271

7372
// Set source to populate the data.
74-
$aitext->set_source_table('qtype_aitext',
75-
['questionid' => backup::VAR_PARENTID]);
73+
$aitext->set_source_table(
74+
'qtype_aitext',
75+
['questionid' => backup::VAR_PARENTID]
76+
);
7677

7778
// Set source to populate the data.
78-
$sampleresponse->set_source_table('qtype_aitext_sampleresponses',
79-
['question' => backup::VAR_PARENTID]);
79+
$sampleresponse->set_source_table(
80+
'qtype_aitext_sampleresponses',
81+
['question' => backup::VAR_PARENTID]
82+
);
8083

8184
// Don't need to annotate ids nor files.
8285

backup/moodle2/restore_qtype_aitext_plugin.class.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3636
*/
3737
class restore_qtype_aitext_plugin extends restore_qtype_plugin {
38-
3938
/**
4039
* Returns the paths to be handled by the plugin at question level
4140
*/
@@ -56,7 +55,6 @@ protected function define_question_plugin_structure() {
5655
$elepath = $this->get_pathfor('/sampleresponses/sampleresponse');
5756
$paths[] = new restore_path_element($elename, $elepath);
5857
return $paths;
59-
6058
}
6159

6260

@@ -82,8 +80,12 @@ public static function convert_backup_to_questiondata(array $backupdata): \stdCl
8280

8381
$questiondata = parent::convert_backup_to_questiondata($backupdata);
8482

85-
$questiondata->options = $DB->get_record('qtype_aitext',
86-
['questionid' => $questiondata->id], '*', MUST_EXIST);
83+
$questiondata->options = $DB->get_record(
84+
'qtype_aitext',
85+
['questionid' => $questiondata->id],
86+
'*',
87+
MUST_EXIST
88+
);
8789
$questiondata->options->sampleresponses = $DB->get_records(
8890
'qtype_aitext_sampleresponses',
8991
['question' => $questiondata->id],
@@ -148,8 +150,10 @@ public function process_aitext($data) {
148150
}
149151

150152
// Detect if the question is created or mapped.
151-
$questioncreated = $this->get_mappingid('question_created',
152-
$this->get_old_parentid('question')) ? true : false;
153+
$questioncreated = $this->get_mappingid(
154+
'question_created',
155+
$this->get_old_parentid('question')
156+
) ? true : false;
153157

154158
// If the question has been created by restore, we need to create its
155159
// qtype_aitext too.

classes/external.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public static function fetch_ai_grade_parameters(): external_function_parameters
5050
'contextid' => new external_value(PARAM_INT, 'The context id'),
5151
]
5252
);
53-
5453
}
5554

5655
/**
@@ -63,16 +62,22 @@ public static function fetch_ai_grade_parameters(): external_function_parameters
6362
* @param int $contextid the context id
6463
* @return stdClass the response
6564
*/
66-
public static function fetch_ai_grade(string $response, int $defaultmark,
67-
string $prompt, string $marksscheme, int $contextid): stdClass {
65+
public static function fetch_ai_grade(
66+
string $response,
67+
int $defaultmark,
68+
string $prompt,
69+
string $marksscheme,
70+
int $contextid
71+
): stdClass {
6872
[
6973
'response' => $response,
7074
'defaultmark' => $defaultmark,
7175
'prompt' => $prompt,
7276
'marksscheme' => $marksscheme,
7377
'contextid' => $contextid,
74-
] = self::validate_parameters(self::fetch_ai_grade_parameters(),
75-
[
78+
] = self::validate_parameters(
79+
self::fetch_ai_grade_parameters(),
80+
[
7681
'response' => $response,
7782
'defaultmark' => $defaultmark,
7883
'prompt' => $prompt,
@@ -114,7 +119,5 @@ public static function fetch_ai_grade_returns(): external_single_structure {
114119
'feedback' => new external_value(PARAM_RAW, 'text feedback for display to student', VALUE_DEFAULT),
115120
'marks' => new external_value(PARAM_FLOAT, 'AI grader awarded marks for student response', VALUE_DEFAULT),
116121
]);
117-
118122
}
119-
120123
}

classes/form/edit_spellcheck.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3131
*/
3232
class edit_spellcheck extends dynamic_form {
33-
3433
/** @var context|null Variable to store the context because it is expensive to retrieve. */
3534
private ?context $context = null;
3635

@@ -95,7 +94,6 @@ protected function check_access_for_dynamic_submission(): void {
9594
) {
9695
throw new \moodle_exception('nocapabilitytousethisservice');
9796
}
98-
9997
}
10098

10199
/**

classes/local/hook_callbacks.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,25 @@
2525
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2626
*/
2727
class hook_callbacks {
28-
2928
/**
3029
* Provide additional information about which purposes are being used by this plugin.
3130
*
3231
* @param \local_ai_manager\hook\purpose_usage $hook the purpose_usage hook object
3332
*/
3433
public static function handle_purpose_usage(\local_ai_manager\hook\purpose_usage $hook): void {
35-
$hook->set_component_displayname('qtype_aitext',
36-
get_string('pluginname_userfaced', 'qtype_aitext'));
37-
$hook->add_purpose_usage_description('feedback', 'qtype_aitext',
38-
get_string('purposeplacedescription_feedback', 'qtype_aitext'));
39-
$hook->add_purpose_usage_description('translate', 'qtype_aitext',
40-
get_string('purposeplacedescription_translate', 'qtype_aitext'));
34+
$hook->set_component_displayname(
35+
'qtype_aitext',
36+
get_string('pluginname_userfaced', 'qtype_aitext')
37+
);
38+
$hook->add_purpose_usage_description(
39+
'feedback',
40+
'qtype_aitext',
41+
get_string('purposeplacedescription_feedback', 'qtype_aitext')
42+
);
43+
$hook->add_purpose_usage_description(
44+
'translate',
45+
'qtype_aitext',
46+
get_string('purposeplacedescription_translate', 'qtype_aitext')
47+
);
4148
}
4249
}

classes/output/mobile.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3333
*/
3434
class mobile {
35-
3635
/**
3736
* Returns the aite question type for the quiz in the mobile app.
3837
* @param array $args
@@ -41,7 +40,7 @@ class mobile {
4140
public static function mobile_get_aitext($args) {
4241
global $CFG;
4342
$args = (object) $args;
44-
$templatepath = $CFG->dirroot."/question/type/aitext/mobile/qtype_aitext.html";
43+
$templatepath = $CFG->dirroot . "/question/type/aitext/mobile/qtype_aitext.html";
4544
return [
4645
'templates' => [
4746
[

classes/privacy/provider.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@
3636
class provider implements
3737
// This component has data.
3838
// We need to return default options that have been set a user preferences.
39-
\core_privacy\local\metadata\provider,
40-
\core_privacy\local\request\user_preference_provider {
41-
39+
\core_privacy\local\metadata\provider,
40+
\core_privacy\local\request\user_preference_provider {
4241
/**
4342
* Returns meta data about this system.
4443
*
@@ -67,7 +66,7 @@ public static function export_user_preferences(int $userid) {
6766

6867
$preference = get_user_preferences('qtype_aitext_responseformat', null, $userid);
6968
if (null !== $preference) {
70-
switch($preference) {
69+
switch ($preference) {
7170
case 'editor':
7271
$stringvalue = get_string('formateditor', 'qtype_aitext');
7372
break;
@@ -105,8 +104,12 @@ public static function export_user_preferences(int $userid) {
105104
$preference = get_user_preferences('qtype_aitext_responsefieldlines', null, $userid);
106105
if (null !== $preference) {
107106
$desc = get_string('privacy:preference:responsefieldlines', 'qtype_aitext');
108-
writer::export_user_preference('qtype_aitext', 'responsefieldlines',
109-
get_string('nlines', 'qtype_aitext', $preference), $desc);
107+
writer::export_user_preference(
108+
'qtype_aitext',
109+
'responsefieldlines',
110+
get_string('nlines', 'qtype_aitext', $preference),
111+
$desc
112+
);
110113
}
111114
$preference = get_user_preferences('qtype_aitext_attachments', null, $userid);
112115
if (null !== $preference) {

classes/task/llm_feedback.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2525
*/
2626
class llm_feedback extends \core\task\scheduled_task {
27-
2827
/**
2928
* Name for this task.
3029
*

db/mobile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
'mobile_get_aitext' => [], // Function in classes/output/mobile.php.
4242
], // Function needs caching for offline.
4343
'styles' => [
44-
'url' => $CFG->wwwroot.'/question/type/aitext/mobile/qtype_aitext_app.css',
44+
'url' => $CFG->wwwroot . '/question/type/aitext/mobile/qtype_aitext_app.css',
4545
'version' => '0.1',
4646
],
4747
],

db/services.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
'qtype_aitext_fetch_ai_grade' => [
3535
'classname' => 'qtype_aitext_external',
3636
'methodname' => 'fetch_ai_grade',
37-
'description' => 'checks a response with the AI grader' ,
37+
'description' => 'checks a response with the AI grader',
3838
'capabilities' => 'mod/quiz:grade',
3939
'type' => 'read',
4040
'ajax' => true,

0 commit comments

Comments
 (0)