From e350d2f59ae0dbb1ed3eba0faf3b1e6d77fe3083 Mon Sep 17 00:00:00 2001
From: Gero Lueckemeyer <gero.lueckemeyer@hft-stuttgart.de>
Date: Mon, 30 Oct 2023 23:23:55 +0100
Subject: [PATCH] adjusted comments and variable names again to match moodle
 approval criteria

---
 dta/locallib.php         |  92 +++++++++++++--------------
 dta/models/DtaResult.php |   4 +-
 dta/utils/backend.php    |  22 +++----
 dta/utils/database.php   |  58 ++++++++---------
 dta/utils/view.php       | 134 +++++++++++++++++++--------------------
 5 files changed, 155 insertions(+), 155 deletions(-)

diff --git a/dta/locallib.php b/dta/locallib.php
index 04c78db..a21cb6e 100644
--- a/dta/locallib.php
+++ b/dta/locallib.php
@@ -16,7 +16,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-//Import various entity and application logic files.
+// Import various entity and application logic files.
 require_once($CFG->dirroot . '/mod/assign/submission/dta/models/DtaResult.php');
 require_once($CFG->dirroot . '/mod/assign/submission/dta/utils/database.php');
 require_once($CFG->dirroot . '/mod/assign/submission/dta/utils/backend.php');
@@ -30,13 +30,13 @@ require_once($CFG->dirroot . '/mod/assign/submission/dta/utils/view.php');
  */
 class assign_submission_dta extends assign_submission_plugin {
 
-    //Broadly used in logic, parametrized for easier change.
+    // Broadly used in logic, parametrized for easier change.
     const COMPONENT_NAME = "assignsubmission_dta";
-    //Draft file area for dta tests to be uploaded by the teacher.
+    // Draft file area for dta tests to be uploaded by the teacher.
     const ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST = "tests_draft_dta";
-    //File area for dta tests to be uploaded by the teacher.
+    // File area for dta tests to be uploaded by the teacher.
     const ASSIGNSUBMISSION_DTA_FILEAREA_TEST = "tests_dta";
-    //File area for dta submission assignment.
+    // File area for dta submission assignment.
     const ASSIGNSUBMISSION_DTA_FILEAREA_SUBMISSION = "submissions_dta";
 
     /**
@@ -54,7 +54,7 @@ class assign_submission_dta extends assign_submission_plugin {
      * @return void
      */
     public function get_settings(MoodleQuickForm $mform): void {
-        //Add draft filemanager to form.
+        // Add draft filemanager to form.
         $mform->addElement(
             "filemanager",
             self::ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST,
@@ -63,22 +63,22 @@ class assign_submission_dta extends assign_submission_plugin {
             $this->get_file_options(true)
         );
 
-        //Add help button to added filemanager.
+        // Add help button to added filemanager.
         $mform->addHelpButton(
-            //Form-unique element id to which to add button.
+            // Form-unique element id to which to add button.
             self::ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST,
             "submission_settings_label",
-            //Language file to use.
+            // Language file to use.
             self::COMPONENT_NAME
         );
 
-        //Only show filemanager if plugin is enabled.
+        // Only show filemanager if plugin is enabled.
         $mform->hideIf(
-            //Form-unique element id to hide.
+            // Form-unique element id to hide.
             self::ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST,
-            //Condition to check.
+            // Condition to check.
             self::COMPONENT_NAME . '_enabled',
-            //State to match for hiding.
+            // State to match for hiding.
             'notchecked'
         );
     }
@@ -90,10 +90,10 @@ class assign_submission_dta extends assign_submission_plugin {
      * @param array $defaultvalues
      */
     public function data_preprocessing(&$defaultvalues): void {
-        //Get id of draft area for file manager creation.
-		$draftitemid = file_get_submitted_draft_itemid(self::ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST);
+        // Get id of draft area for file manager creation.
+        $draftitemid = file_get_submitted_draft_itemid(self::ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST);
 
-        //Prepare draft area with created draft filearea.
+        // Prepare draft area with created draft filearea.
         file_prepare_draft_area(
             $draftitemid,
             $this->assignment->get_context()->id,
@@ -114,27 +114,27 @@ class assign_submission_dta extends assign_submission_plugin {
      */
     public function save_settings(stdClass $data): bool {
 
-        //If the assignment has no filemanager for our plugin just leave.
+        // If the assignment has no filemanager for our plugin just leave.
         $draftfilemanagerid = self::ASSIGNSUBMISSION_DTA_DRAFT_FILEAREA_TEST;
         if (!isset($data->$draftfilemanagerid)) {
             return true;
         }
 
-        //Store files from draft filearea to final one.
+        // Store files from draft filearea to final one.
         file_save_draft_area_files(
-            //Form-unique element id of draft filemanager from the edit.
+            // Form-unique element id of draft filemanager from the edit.
             $data->$draftfilemanagerid,
-            //Id of the assignment in edit.
+            // Id of the assignment in edit.
             $this->assignment->get_context()->id,
             self::COMPONENT_NAME,
             self::ASSIGNSUBMISSION_DTA_FILEAREA_TEST,
             0
         );
 
-        //Get files from proper filearea.
+        // Get files from proper filearea.
         $fs = get_file_storage();
         $files = $fs->get_area_files(
-            //Id of the current assignment.
+            // Id of the current assignment.
             $this->assignment->get_context()->id,
             self::COMPONENT_NAME,
             self::ASSIGNSUBMISSION_DTA_FILEAREA_TEST,
@@ -143,16 +143,16 @@ class assign_submission_dta extends assign_submission_plugin {
             false
         );
 
-        //Check if a file was uploaded.
+        // Check if a file was uploaded.
         if (empty($files)) {
             \core\notification::error(get_string("no_testfile_warning", self::COMPONENT_NAME));
             return true;
         }
 
-        //Get the file.
+        // Get the file.
         $file = reset($files);
 
-        //Send file to backend.
+        // Send file to backend.
         return DtaBackendUtils::sendTestConfigToBackend($this->assignment, $file);
     }
 
@@ -166,7 +166,7 @@ class assign_submission_dta extends assign_submission_plugin {
      * @return bool
      */
     public function get_form_elements_for_user($submissionorgrade, MoodleQuickForm $mform, stdClass $data, $userid): bool {
-        //Prepare submission filearea.
+        // Prepare submission filearea.
         $data = file_prepare_standard_filemanager(
             $data,
             'tasks',
@@ -177,26 +177,26 @@ class assign_submission_dta extends assign_submission_plugin {
             $submissionorgrade ? $submissionorgrade->id : 0
         );
 
-        //Add filemanager to form.
+        // Add filemanager to form.
         $mform->addElement(
             'filemanager',
-            //Form-unique identifier.
+            // Form-unique identifier.
             'tasks_filemanager',
-            //Label to show next to the filemanager.
+            // Label to show next to the filemanager.
             get_string("submission_label", self::COMPONENT_NAME),
-            //Attributes.
+            // Attributes.
             null,
-            //Options.
+            // Options.
             $this->get_file_options(false)
         );
 
-        //Add help button.
+        // Add help button.
         $mform->addHelpButton(
-            //Related form item.
+            // Related form item.
             "tasks_filemanager",
-            //Key.
+            // Key.
             "submission_label",
-            //Language file.
+            // Language file.
             self::COMPONENT_NAME
         );
 
@@ -248,15 +248,15 @@ class assign_submission_dta extends assign_submission_plugin {
             $submission->id
         );
 
-        //If submission is empty leave directly.
+        // If submission is empty leave directly.
         if ($this->is_empty($submission)) {
             return true;
         }
 
-        //Get submitted files.
+        // Get submitted files.
         $fs = get_file_storage();
         $files = $fs->get_area_files(
-            //Id of current assignment.
+            // Id of current assignment.
             $this->assignment->get_context()->id,
             self::COMPONENT_NAME,
             self::ASSIGNSUBMISSION_DTA_FILEAREA_SUBMISSION,
@@ -265,27 +265,27 @@ class assign_submission_dta extends assign_submission_plugin {
             false
         );
 
-        //Check if a file is uploaded.
+        // Check if a file is uploaded.
         if (empty($files)) {
             \core\notification::error(get_string("no_submissionfile_warning", self::COMPONENT_NAME));
             return true;
         }
 
-        //Get the file.
+        // Get the file.
         $file = reset($files);
-        
-		//Send file to backend.
+
+        // Send file to backend.
         $response = DtaBackendUtils::sendSubmissionToBackend($this->assignment, $file);
 
-        //With a null response, return an error.
+        // With a null response, return an error.
         if (is_null($response)) {
             return false;
         }
 
-        //Convert received json to valid class instances.
+        // Convert received json to valid class instances.
         $resultsummary = DtaResultSummary::decodeJson($response);
 
-        //Persist new results to database.
+        // Persist new results to database.
         DbUtils::storeResultSummaryToDatabase($this->assignment->get_instance()->id, $submission->id, $resultsummary);
 
         return true;
@@ -367,7 +367,7 @@ class assign_submission_dta extends assign_submission_plugin {
             false);
 
         foreach ($files as $file) {
-            //Do we return the full folder path or just the file name?
+            // Do we return the full folder path or just the file name?
             if (isset($submission->exportfullpath) && $submission->exportfullpath == false) {
                 $result[$file->get_filename()] = $file;
             } else {
diff --git a/dta/models/DtaResult.php b/dta/models/DtaResult.php
index add16c3..9740c5a 100644
--- a/dta/models/DtaResult.php
+++ b/dta/models/DtaResult.php
@@ -60,8 +60,8 @@ class DtaResultSummary {
 
     public $timestamp;
     public $globalStacktrace;
-	public $successfulTestCompetencyProfile;
-	public $overallTestCompetencyProfile;
+    public $successfulTestCompetencyProfile;
+    public $overallTestCompetencyProfile;
     public $results;
 
     /**
diff --git a/dta/utils/backend.php b/dta/utils/backend.php
index 2a4349d..706ecb8 100644
--- a/dta/utils/backend.php
+++ b/dta/utils/backend.php
@@ -43,16 +43,16 @@ class DtaBackendUtils {
             return true;
         }
 
-        //Set endpoint for test upload.
+        // Set endpoint for test upload.
         $url = $backendaddress . "/v1/unittest";
 
-        //Prepare params.
+        // Prepare params.
         $params = array(
             "unitTestFile" => $file,
             "assignmentId" => $assignment->get_instance()->id
         );
 
-        //If request returned null, return false to indicate failure.
+        // If request returned null, return false to indicate failure.
         if (is_null(self::post($url, $params))) {
             return false;
         } else {
@@ -74,10 +74,10 @@ class DtaBackendUtils {
             return true;
         }
 
-        //Set endpoint for test upload.
+        // Set endpoint for test upload.
         $url = $backendaddress . "/v1/task";
 
-        //Prepare params.
+        // Prepare params.
         $params = array(
             "taskFile" => $file,
             "assignmentId" => $assignment->get_instance()->id
@@ -104,15 +104,15 @@ class DtaBackendUtils {
         $curl = new curl();
         $response = $curl->post($url, $params, $options);
 
-        //Check state of request, if response code is a 2xx return the answer.
+        // Check state of request, if response code is a 2xx return the answer.
         $info = $curl->get_info();
         if ($info["http_code"] >= 200 && $info["http_code"] < 300) {
             return $response;
         }
 
-        //Something went wrong, return null and give an error message.
-        debugging(assign_submission_dta::COMPONENT_NAME . ": Post file to server was not successful: http_code=" . 
-		$info["http_code"]);
+        // Something went wrong, return null and give an error message.
+        debugging(assign_submission_dta::COMPONENT_NAME . ": Post file to server was not successful: http_code=" .
+        $info["http_code"]);
 
         if ($info['http_code'] >= 400 && $info['http_code'] < 500) {
             \core\notification::error(get_string("http_client_error_msg", assign_submission_dta::COMPONENT_NAME));
@@ -121,8 +121,8 @@ class DtaBackendUtils {
             \core\notification::error(get_string("http_server_error_msg", assign_submission_dta::COMPONENT_NAME));
             return null;
         } else {
-            \core\notification::error(get_string("http_unknown_error_msg", assign_submission_dta::COMPONENT_NAME) . 
-			$info["http_code"] . $response);
+            \core\notification::error(get_string("http_unknown_error_msg", assign_submission_dta::COMPONENT_NAME) .
+            $info["http_code"] . $response);
             return null;
         }
     }
diff --git a/dta/utils/database.php b/dta/utils/database.php
index 6da56b7..0255d1a 100644
--- a/dta/utils/database.php
+++ b/dta/utils/database.php
@@ -16,9 +16,9 @@
 
 class DbUtils {
 
-    // summary database table name
+    // Summary database table name.
     private const TABLE_SUMMARY = "assignsubmission_dta_summary";
-    // result database table name
+    // Result database table name.
     private const TABLE_RESULT = "assignsubmission_dta_result";
 
     /**
@@ -34,27 +34,27 @@ class DbUtils {
     ): DtaResultSummary {
         global $DB;
 
-        //Fetch data from database.
-        $summary_record = $DB->get_record(self::TABLE_SUMMARY, array(
+        // Fetch data from database.
+        $summaryrecord = $DB->get_record(self::TABLE_SUMMARY, array(
             "assignment_id" => $assignmentid,
             "submission_id" => $submissionid
         ));
 
-        $results_array = $DB->get_records(self::TABLE_RESULT, array(
+        $resultsarray = $DB->get_records(self::TABLE_RESULT, array(
             "assignment_id" => $assignmentid,
             "submission_id" => $submissionid
         ));
 
-        //Create a summary instance.
+        // Create a summary instance.
         $summary = new DtaResultSummary();
-        $summary->timestamp = $summary_record->timestamp;
-        $summary->globalStacktrace = $summary_record->global_stacktrace;
-        $summary->successfulTestCompetencyProfile = $summary_record->successful_competencies;
-        $summary->overallTestCompetencyProfile = $summary_record->tested_competencies;
+        $summary->timestamp = $summaryrecord->timestamp;
+        $summary->globalStacktrace = $summaryrecord->global_stacktrace;
+        $summary->successfulTestCompetencyProfile = $summaryrecord->successful_competencies;
+        $summary->overallTestCompetencyProfile = $summaryrecord->tested_competencies;
         $summary->results = array();
 
-        //Create result instances and add to array of summary instance.
-        foreach($results_array as $rr) {
+        // Create result instances and add to array of summary instance.
+        foreach ($resultsarray as $rr) {
             $result = new DtaResult();
             $result->packageName = $rr->package_name;
             $result->className = $rr->class_name;
@@ -88,18 +88,18 @@ class DbUtils {
     ): void {
         global $DB;
 
-        //Prepare new database entries.
-        $summary_record = new stdClass();
-        $summary_record->assignment_id = $assignmentid;
-        $summary_record->submission_id = $submissionid;
-        $summary_record->successful_competencies = $summary->successfulTestCompetencyProfile;
-        $summary_record->tested_competencies = $summary->overallTestCompetencyProfile;
-        $summary_record->timestamp = $summary->timestamp;
-        $summary_record->global_stacktrace = $summary->globalStacktrace;
-
-        //Prepare results to persist to array.
-        $result_records = array();
-        foreach($summary->results as $r) {
+        // Prepare new database entries.
+        $summaryrecord = new stdClass();
+        $summaryrecord->assignment_id = $assignmentid;
+        $summaryrecord->submission_id = $submissionid;
+        $summaryrecord->successful_competencies = $summary->successfulTestCompetencyProfile;
+        $summaryrecord->tested_competencies = $summary->overallTestCompetencyProfile;
+        $summaryrecord->timestamp = $summary->timestamp;
+        $summaryrecord->global_stacktrace = $summary->globalStacktrace;
+
+        // Prepare results to persist to array.
+        $resultrecords = array();
+        foreach ($summary->results as $r) {
             $record = new stdClass();
             $record->assignment_id = $assignmentid;
             $record->submission_id = $submissionid;
@@ -113,10 +113,10 @@ class DbUtils {
             $record->column_number = $r->columnNumber;
             $record->line_number = $r->lineNumber;
             $record->position = $r->position;
-            $result_records[] = $record;
+            $resultrecords[] = $record;
         }
 
-        //If results already exist, delete old values beforehand.
+        // If results already exist, delete old values beforehand.
         $submission = $DB->get_record(self::TABLE_SUMMARY, array(
             'assignment_id' => $assignmentid,
             'submission_id' => $submissionid
@@ -134,9 +134,9 @@ class DbUtils {
             ));
         }
 
-        //Create summary and single result entries.
-        $DB->insert_record(self::TABLE_SUMMARY, $summary_record);
-        foreach($result_records as $rr) {
+        // Create summary and single result entries.
+        $DB->insert_record(self::TABLE_SUMMARY, $summaryrecord);
+        foreach ($resultrecords as $rr) {
             $DB->insert_record(self::TABLE_RESULT, $rr);
         }
     }
diff --git a/dta/utils/view.php b/dta/utils/view.php
index c211a9b..3927c54 100644
--- a/dta/utils/view.php
+++ b/dta/utils/view.php
@@ -28,17 +28,17 @@ class ViewSubmissionUtils {
         int $submissionid
     ): string {
 
-        //Fetch data.
+        // Fetch data.
         $summary = DbUtils::getResultSummaryFromDatabase($assignmentid, $submissionid);
         $html = "";
 
-        //Calculate success rate, if no unknown result states or compilation errors.
+        // Calculate success rate, if no unknown result states or compilation errors.
         $successrate = "?";
         if ($summary->unknownCount() == 0 && $summary->compilationErrorCount() == 0) {
             $successrate = round(($summary->successfulCount() / $summary->resultCount()) * 100, 2 );
         }
 
-        //Generate html.
+        // Generate html.
         $html .= $summary->successfulCount() . "/";
         $html .= ($summary->compilationErrorCount() == 0 && $summary->unknownCount() == 0)
             ? $summary->resultCount() . " (" . $successrate . "%)"
@@ -52,8 +52,8 @@ class ViewSubmissionUtils {
         if ($summary->unknownCount() > 0) {
             $html .= $summary->unknownCount() . " test(s) with unknown state<br>";
         }
-		
-		$html .= $summary->successfulTestCompetencyProfile . " successfully tested competency profile<br>";
+
+        $html .= $summary->successfulTestCompetencyProfile . " successfully tested competency profile<br>";
 
         return html_writer::div($html, "dtaSubmissionSummary");
     }
@@ -69,24 +69,24 @@ class ViewSubmissionUtils {
         int $submissionid
     ): string {
 
-        //Fetch data.
+        // Fetch data.
         $summary = DbUtils::getResultSummaryFromDatabase($assignmentid, $submissionid);
         $html = "";
 
-        //Define a few css classes and prepare html attribute arrays to beautify the output.
-        $tableheaderrow_attributes = array("class" => "dtaTableHeaderRow");
-        $tablerow_attributes = array("class" => "dtaTableRow");
-        $resultrow_attributes = $tablerow_attributes;
-        $unknown_attributes = 'dtaResultUnknown';
-        $success_attributes = 'dtaResultSuccess';
-        $failure_attributes = 'dtaResultFailure';
-        $compilationerror_attributes = 'dtaResultCompilationError';
+        // Define a few css classes and prepare html attribute arrays to beautify the output.
+        $tableheaderrowattributes = array("class" => "dtaTableHeaderRow");
+        $tablerowattributes = array("class" => "dtaTableRow");
+        $resultrowattributes = $tablerowattributes;
+        $unknownattributes = 'dtaResultUnknown';
+        $successattributes = 'dtaResultSuccess';
+        $failureattributes = 'dtaResultFailure';
+        $compilationerrorattributes = 'dtaResultCompilationError';
 
-        //Summary table.
+        // Summary table.
         $tmp = "";
         $tmp .= html_writer::tag("th", "Summary", array("class" => "dtaTableHeader"));
         $tmp .= html_writer::empty_tag("th", array("class" => "dtaTableHeader"));
-        $header = html_writer::tag("tr", $tmp, $tableheaderrow_attributes);
+        $header = html_writer::tag("tr", $tmp, $tableheaderrowattributes);
         $header = html_writer::tag("thead", $header);
 
         $body = "";
@@ -102,70 +102,70 @@ class ViewSubmissionUtils {
             $summary->resultCount(),
             $attributes);
 
-        $resultrow_attributes = $tablerow_attributes;
-        $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $unknown_attributes;
+        $resultrowattributes = $tablerowattributes;
+        $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $unknownattributes;
         
-        $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+        $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
 
         $tmp = "";
         $tmp .= html_writer::tag("td", "successes", $attributes);
         $tmp .= html_writer::tag( "td", $summary->successfulCount(), $attributes);
 
-        $resultrow_attributes = $tablerow_attributes;
+        $resultrowattributes = $tablerowattributes;
         $successrate = "?";
 
         if ($summary->unknownCount() > 0 || $summary->compilationErrorCount() > 0) {
-            $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $unknown_attributes;
+            $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $unknownattributes;
         } else {
             $successrate = round(($summary->successfulCount() / $summary->resultCount()) * 100, 2 );
             if ($successrate < 50) {
-                $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $compilationerror_attributes;
+                $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $compilationerrorattributes;
             } else if ($successrate < 75) {
-                $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $failure_attributes;
+                $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $failureattributes;
             } else {
-                $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $success_attributes;
+                $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $successattributes;
             }
         }
-        $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+        $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
 
         $tmp = "";
         $tmp .= html_writer::tag("td", "failures", $attributes);
         $tmp .= html_writer::tag("td", $summary->failedCount(), $attributes);
 
-        $resultrow_attributes = $tablerow_attributes;
+        $resultrowattributes = $tablerowattributes;
         if ($summary->failedCount() > 0) {
-            $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $failure_attributes;
+            $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $failureattributes;
         } else {
-            $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $success_attributes;
+            $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $successattributes;
         }
-        $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+        $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
 
         $tmp = "";
         $tmp .= html_writer::tag("td", "compilation errors", $attributes);
         $tmp .= html_writer::tag("td", $summary->compilationErrorCount(), $attributes);
 
-        $resultrow_attributes = $tablerow_attributes;
+        $resultrowattributes = $tablerowattributes;
         if ($summary->compilationErrorCount() > 0) {
-            $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $compilationerror_attributes;
+            $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $compilationerrorattributes;
         } else {
-            $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $success_attributes;
+            $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $successattributes;
         }
-        $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+        $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
 
         $tmp = "";
         $tmp .= html_writer::tag("td", "unknown state", $attributes);
         $tmp .= html_writer::tag("td", $summary->unknownCount(), $attributes);
 
-        $resultrow_attributes = $tablerow_attributes;
+        $resultrowattributes = $tablerowattributes;
         if ($summary->unknownCount() > 0) {
-            $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $unknown_attributes;
+            $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $unknownattributes;
         } else {
-            $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $success_attributes;
+            $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $successattributes;
         }
-        $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+        $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
 
         $tmp = "";
-        $tmp .= html_writer::tag("td", html_writer::tag("b","success rate"), $attributes);
+        $tmp .= html_writer::tag("td", html_writer::tag("b", "success rate"), $attributes);
         $tmp .= html_writer::tag(
             "td",
             html_writer::tag("b", $summary->successfulCount()
@@ -174,55 +174,55 @@ class ViewSubmissionUtils {
                     : "?")),
             $attributes);
 
-        $resultrow_attributes = $tablerow_attributes;
+        $resultrowattributes = $tablerowattributes;
         if ($summary->unknownCount() > 0 || $summary->compilationErrorCount() > 0) {
-            $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $unknown_attributes;
+            $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $unknownattributes;
         } else {
             if ($successrate < 50) {
-                $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $compilationerror_attributes;
+                $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $compilationerrorattributes;
             } else if ($successrate < 75) {
-                $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $failure_attributes;
+                $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $failureattributes;
             } else {
-                $resultrow_attributes['class'] = $resultrow_attributes['class'] . " " . $success_attributes;
+                $resultrowattributes['class'] = $resultrowattributes['class'] . " " . $successattributes;
             }
         }
-        $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+        $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
 
         $body = html_writer::tag("tbody", $body);
         $table = html_writer::tag("table", $header . $body, array("class" => "dtaTable"));
 
         $html .= $table;
 
-        //Add empty div for spacing between summary and details table.
+        // Add empty div for spacing between summary and details table.
         $html .= html_writer::empty_tag("div", array("class" => "dtaSpacer"));
 
-        //Details table.
+        // Details table.
         $tmp = "";
         $tmp .= html_writer::tag("th", "Details", array("class" => "dtaTableHeader"));
         $tmp .= html_writer::empty_tag("th", array("class" => "dtaTableHeader"));
-        $header = html_writer::tag("tr", $tmp, $tableheaderrow_attributes);
+        $header = html_writer::tag("tr", $tmp, $tableheaderrowattributes);
         $header = html_writer::tag("thead", $header);
 
         $body = "";
         $spacerrow = null;
         foreach($summary->results as $r) {
-            //Add spacer first if not null.
+            // Add spacer first if not null.
             if (!is_null($spacerrow)) {
                 $body .= $spacerrow;
             }
 
-            //New copy of base attributes array.
-            $resultrow_attributes = $tablerow_attributes;
+            // New copy of base attributes array.
+            $resultrowattributes = $tablerowattributes;
 
-            //Check which css class to add for the colored left-border according to resuls state.
+            // Check which css class to add for the colored left-border according to resuls state.
             if ($r->state == 0) {
-                $resultrow_attributes['class'] = $resultrow_attributes['class'] . ' dtaResultUnknown';
+                $resultrowattributes['class'] = $resultrowattributes['class'] . ' dtaResultUnknown';
             } else if ($r->state == 1) {
-                $resultrow_attributes['class'] = $resultrow_attributes['class'] . ' dtaResultSuccess';
+                $resultrowattributes['class'] = $resultrowattributes['class'] . ' dtaResultSuccess';
             } else if ($r->state == 2) {
-                $resultrow_attributes['class'] = $resultrow_attributes['class'] . ' dtaResultFailure';
+                $resultrowattributes['class'] = $resultrowattributes['class'] . ' dtaResultFailure';
             } else if ($r->state == 3) {
-                $resultrow_attributes['class'] = $resultrow_attributes['class'] . ' dtaResultCompilationError';
+                $resultrowattributes['class'] = $resultrowattributes['class'] . ' dtaResultCompilationError';
             }
 
             $tmp = "";
@@ -235,7 +235,7 @@ class ViewSubmissionUtils {
                 "td",
                 $r->name,
                 $attributes);
-            $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+            $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
 
             $tmp = "";
             $tmp .= html_writer::tag(
@@ -247,9 +247,9 @@ class ViewSubmissionUtils {
                 "td",
                 DtaResult::getStateName($r->state),
                 $attributes);
-            $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+            $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
 
-            //If state is something different than successful, show additional rows.
+            // If state is something different than successful, show additional rows.
             if ($r->state != 1) {
                 $tmp = "";
                 $tmp .= html_writer::tag(
@@ -261,7 +261,7 @@ class ViewSubmissionUtils {
                     "td",
                     $r->failureType,
                     $attributes);
-                $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+                $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
 
                 $tmp = "";
                 $tmp .= html_writer::tag(
@@ -273,9 +273,9 @@ class ViewSubmissionUtils {
                     "td",
                     $r->failureReason,
                     $attributes);
-                $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+                $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
 
-                //Only show line, column and position if they have useful values.
+                // Only show line, column and position if they have useful values.
                 if (!is_null($r->lineNumber) && $r->lineNumber > 0) {
                     $tmp = "";
                     $tmp .= html_writer::tag(
@@ -287,7 +287,7 @@ class ViewSubmissionUtils {
                         "td",
                         $r->lineNumber,
                         $attributes);
-                    $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+                    $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
                 }
 
                 if (!is_null($r->columnNumber) && $r->columnNumber > 0) {
@@ -301,7 +301,7 @@ class ViewSubmissionUtils {
                     "td",
                     $r->columnNumber,
                     $attributes);
-                $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+                $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
                 }
 
                 if (!is_null($r->position) && $r->position > 0) {
@@ -315,7 +315,7 @@ class ViewSubmissionUtils {
                     "td",
                     $r->position,
                     $attributes);
-                $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+                $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
                 }
 
                 $tmp = "";
@@ -328,17 +328,17 @@ class ViewSubmissionUtils {
                     "td",
                     html_writer::tag("details", $r->stacktrace, array("class" => "dtaStacktraceDetails")),
                     $attributes);
-                $body .= html_writer::tag("tr", $tmp, $resultrow_attributes);
+                $body .= html_writer::tag("tr", $tmp, $resultrowattributes);
             }
 
-            //Set spacerrow value if null for next rount separation.
+            // Set spacerrow value if null for next rount separation.
             if (is_null($spacerrow)) {
                 $spacerrow = html_writer::empty_tag("tr", array("class" => "dtaTableSpacer"));
             }
         }
         $html .= html_writer::tag("table", $header . $body, array("class" => "dtaTable"));
 
-        // wrap generated html into final div
+        // Wrap generated html into final div.
         $html = html_writer::div($html, "dtaSubmissionDetails");
 
         return $html;
-- 
GitLab