Skip to content

Commit

Permalink
Fix codestyle checker issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Jokeswar committed Mar 5, 2023
1 parent 3f30a4d commit 9dc9904
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion classes/backend/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ private function query_service(string $endpoint, ?array $queryparams, ?array $pa

$rawresponse = '';
if ($payload !== null) {
$rawresponse = $curl->post($cleanurl, json_encode($payload), array('CURLOPT_HTTPHEADER' => array("Content-Type: application/json")));
$rawresponse = $curl->post(
$cleanurl,
json_encode($payload),
array('CURLOPT_HTTPHEADER' => array("Content-Type: application/json"))
);
} else {
$rawresponse = $curl->get($cleanurl, $queryparams);
}
Expand Down
8 changes: 4 additions & 4 deletions classes/task/submission_checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private function done_submission($api, $submission) {
*/
private function format_feedback(string $trace) {
$tracelines = explode(PHP_EOL, $trace);
$tracelines = array_slice($tracelines, 0, \block_vmchecker\task\submission_checker::NUMBER_OF_FEEDBACK_LINES);
$tracelines = array_slice($tracelines, 0, self::NUMBER_OF_FEEDBACK_LINES);
return implode(PHP_EOL, $tracelines);
}

Expand All @@ -121,11 +121,11 @@ private function format_feedback(string $trace) {
* @return string
*/
private function clean_trace(string $trace) {
$offset = strpos($trace, \block_vmchecker\task\submission_checker::VMCK_NEXT_BEGIN);
$offset = strpos($trace, self::VMCK_NEXT_BEGIN);
$this->log('Found start cleanup mark at: ' . $offset);
$trace = substr($trace, $offset + strlen(\block_vmchecker\task\submission_checker::VMCK_NEXT_BEGIN) + 1); // Add new line.
$trace = substr($trace, $offset + strlen(self::VMCK_NEXT_BEGIN) + 1); // Add new line.

$offset = strpos($trace, \block_vmchecker\task\submission_checker::VMCK_NEXT_END);
$offset = strpos($trace, self::VMCK_NEXT_END);
$this->log('Found end cleanup mark at: ' . $offset);
$trace = substr($trace, 0, $offset);

Expand Down
8 changes: 4 additions & 4 deletions db/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@

$observers = array(
array(
'eventname' => 'mod_assign\event\submission_created',
'callback' => 'block_vmchecker\listener\observer::submit',
'eventname' => 'mod_assign\event\submission_created',
'callback' => 'block_vmchecker\listener\observer::submit',
),
array(
'eventname' => 'mod_assign\event\submission_updated',
'callback' => 'block_vmchecker\listener\observer::submit',
'eventname' => 'mod_assign\event\submission_updated',
'callback' => 'block_vmchecker\listener\observer::submit',
),
);

0 comments on commit 9dc9904

Please sign in to comment.