Skip to content

Commit a2d3209

Browse files
committed
style: have phpcbf replace string double-quotes with single-quotes
1 parent fd3b65f commit a2d3209

File tree

77 files changed

+498
-498
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+498
-498
lines changed

classes/api/api.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static function extract_package_info(stored_file $file): package_raw {
109109
'package' => curl_file_create($filepath),
110110
];
111111

112-
$response = $connector->post("/package-extract-info", $data);
112+
$response = $connector->post('/package-extract-info', $data);
113113
$response->assert_2xx();
114114
return array_converter::from_array(package_raw::class, $response->get_data());
115115
}
@@ -122,7 +122,7 @@ public static function extract_package_info(stored_file $file): package_raw {
122122
*/
123123
public static function get_server_status(): status {
124124
$connector = connector::default();
125-
$response = $connector->get("/status");
125+
$response = $connector->get('/status');
126126
$response->assert_2xx();
127127
return array_converter::from_array(status::class, $response->get_data());
128128
}

classes/api/attempt_file.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class attempt_file {
3131
public string $name;
3232

3333
/** @var string|null */
34-
#[array_key("mime_type")]
34+
#[array_key('mime_type')]
3535
public ?string $mimetype = null;
3636

3737
/** @var string $data */

classes/api/attempt_scored.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
*/
2929
class attempt_scored extends attempt {
3030
/** @var string|null */
31-
#[array_key("scoring_state")]
31+
#[array_key('scoring_state')]
3232
public ?string $scoringstate;
3333

3434
/** @var scoring_code */
35-
#[array_key("scoring_code")]
35+
#[array_key('scoring_code')]
3636
public scoring_code $scoringcode;
3737

3838
/** @var float|null */

classes/api/attempt_started.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
class attempt_started extends attempt {
3030
/** @var string */
31-
#[array_key("attempt_state")]
31+
#[array_key('attempt_state')]
3232
public string $attemptstate;
3333

3434
/**

classes/api/attempt_ui.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,31 @@ class attempt_ui {
3232
public string $formulation;
3333

3434
/** @var string|null */
35-
#[array_key("general_feedback")]
35+
#[array_key('general_feedback')]
3636
public ?string $generalfeedback = null;
3737

3838
/** @var string|null */
39-
#[array_key("specific_feedback")]
39+
#[array_key('specific_feedback')]
4040
public ?string $specificfeedback = null;
4141

4242
/** @var string|null */
43-
#[array_key("right_answer")]
43+
#[array_key('right_answer')]
4444
public ?string $rightanswer = null;
4545

4646
/** @var array<string, string> string to string mapping of placeholder names to the values (to be replaced in the content) */
4747
public array $placeholders = [];
4848

4949
/** @var string[]|null */
50-
#[array_key("css_files")]
50+
#[array_key('css_files')]
5151
public ?array $cssfiles = null;
5252

5353
/** @var array<string, attempt_file> specifics TBD */
5454
#[array_element_class(attempt_file::class)]
5555
public array $files = [];
5656

5757
/** @var string specifics TBD */
58-
#[array_key("cache_control")]
59-
public string $cachecontrol = "PRIVATE_CACHE";
58+
#[array_key('cache_control')]
59+
public string $cachecontrol = 'PRIVATE_CACHE';
6060

6161
/**
6262
* Initializes a new instance.

classes/api/package_api.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,17 @@ private function guzzle_post_and_maybe_retry(string $uri, array $options = [], b
194194

195195
$fd = $this->file->get_content_file_handle();
196196
try {
197-
$options["multipart"][] = [
198-
"name" => "package",
199-
"contents" => $fd,
197+
$options['multipart'][] = [
198+
'name' => 'package',
199+
'contents' => $fd,
200200
];
201201

202202
return $this->guzzle_post_and_maybe_retry($uri, $options, allowretry: false);
203203
} finally {
204204
@fclose($fd);
205205
}
206206
} catch (GuzzleException $e) {
207-
throw new coding_exception("Request to QPy server failed: " . $e->getMessage());
207+
throw new coding_exception('Request to QPy server failed: ' . $e->getMessage());
208208
}
209209
}
210210

@@ -226,7 +226,7 @@ public function download_static_file(string $namespace, string $shortname, strin
226226
try {
227227
$res = $this->guzzle_post_and_maybe_retry(
228228
"/packages/$this->hash/file/$namespace/$shortname/$kind/$path",
229-
["sink" => $targetpath]
229+
['sink' => $targetpath]
230230
);
231231
} catch (BadResponseException $e) {
232232
if ($e->getResponse()->getStatusCode() == 404) {
@@ -239,11 +239,11 @@ public function download_static_file(string $namespace, string $shortname, strin
239239
);
240240
}
241241

242-
if ($res->hasHeader("Content-Type")) {
243-
return $res->getHeader("Content-Type")[0];
242+
if ($res->hasHeader('Content-Type')) {
243+
return $res->getHeader('Content-Type')[0];
244244
} else {
245-
debugging("Server did not send Content-Type header, falling back to application/octet-stream");
246-
return "application/octet-stream";
245+
debugging('Server did not send Content-Type header, falling back to application/octet-stream');
246+
return 'application/octet-stream';
247247
}
248248
}
249249

classes/api/qpy_http_client.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class qpy_http_client extends http_client {
3737
* @throws dml_exception
3838
*/
3939
public function __construct(array $config = []) {
40-
$config["base_uri"] = rtrim(get_config('qtype_questionpy', 'server_url'), "/") . "/";
41-
$config["timeout"] = get_config('qtype_questionpy', 'server_timeout');
40+
$config['base_uri'] = rtrim(get_config('qtype_questionpy', 'server_url'), '/') . '/';
41+
$config['timeout'] = get_config('qtype_questionpy', 'server_timeout');
4242
parent::__construct($config);
4343
}
4444

@@ -53,7 +53,7 @@ protected function get_handlers(array $settings): HandlerStack {
5353
/* This checks requests against Moodle's curlsecurityblockedhosts, which we don't want, since admins would need
5454
to ensure their QPy server isn't in this list otherwise. There may be ways to granularly allow the
5555
server_url, but this will do for now. */
56-
$handlerstack->remove("moodle_check_initial_request");
56+
$handlerstack->remove('moodle_check_initial_request');
5757
return $handlerstack;
5858
}
5959
}

classes/api/question_edit_form_response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class question_edit_form_response {
3232
public qpy_form $definition;
3333

3434
/** @var array */
35-
#[array_key("form_data")]
35+
#[array_key('form_data')]
3636
public array $formdata;
3737

3838
/**

classes/api/question_response.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,34 @@
2828
*/
2929
class question_response {
3030
/** @var string */
31-
#[array_key("question_state")]
31+
#[array_key('question_state')]
3232
public string $state;
3333

3434
/** @var string */
35-
#[array_key("scoring_method")]
35+
#[array_key('scoring_method')]
3636
public string $scoringmethod;
3737

3838
/** @var float|int */
39-
#[array_key("score_min")]
39+
#[array_key('score_min')]
4040
public float $scoremin = 0;
4141

4242
/** @var float|int */
43-
#[array_key("score_max")]
43+
#[array_key('score_max')]
4444
public float $scoremax = 1;
4545

4646
/** @var float|null */
4747
public ?float $penalty = null;
4848

4949
/** @var float|null */
50-
#[array_key("random_guess_score")]
50+
#[array_key('random_guess_score')]
5151
public ?float $randomguessscore = null;
5252

5353
/** @var bool */
54-
#[array_key("render_every_view")]
54+
#[array_key('render_every_view')]
5555
public bool $rendereveryview = false;
5656

5757
/** @var string|null */
58-
#[array_key("general_feedback")]
58+
#[array_key('general_feedback')]
5959
public ?string $generalfeedback = null;
6060

6161
/**

classes/api/scoring_code.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2727
*/
2828
enum scoring_code: string {
29-
case automatically_scored = "AUTOMATICALLY_SCORED";
30-
case needs_manual_scoring = "NEEDS_MANUAL_SCORING";
31-
case response_not_scorable = "RESPONSE_NOT_SCORABLE";
32-
case invalid_response = "INVALID_RESPONSE";
29+
case automatically_scored = 'AUTOMATICALLY_SCORED';
30+
case needs_manual_scoring = 'NEEDS_MANUAL_SCORING';
31+
case response_not_scorable = 'RESPONSE_NOT_SCORABLE';
32+
case invalid_response = 'INVALID_RESPONSE';
3333
}

0 commit comments

Comments
 (0)