Skip to content

Commit

Permalink
Merge pull request maths#1338 from maths/code-tidy
Browse files Browse the repository at this point in the history
Code tidy
  • Loading branch information
sangwinc authored Dec 18, 2024
2 parents 7ad0204 + 64d326c commit a71e1ed
Show file tree
Hide file tree
Showing 398 changed files with 6,856 additions and 2,532 deletions.
1 change: 1 addition & 0 deletions adminui/answertests.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* correctly, and second it serves to document the expected behaviour of answer
* tests, which is useful for learning how they work.
*
* @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
1 change: 1 addition & 0 deletions adminui/cascacheview.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* This script lets the user see the latest commands stored to CAS
* cache as pretty printted presentations. This exists for debugging.
*
* @package qtype_stack
* @copyright 2019 Aalto University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
1 change: 1 addition & 0 deletions adminui/caschat.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* This can be useful for learning about the CAS syntax, and also for testing
* that maxima is working correctly.
*
* @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
1 change: 1 addition & 0 deletions adminui/compiledquestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*
* This is for developers.
*
* @package qtype_stack
* @copyright 2022 Aalto University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
1 change: 1 addition & 0 deletions adminui/dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* the whole logic in a fast way. Thus this does not work for questions
* that have not been compiled.
*
* @package qtype_stack
* @copyright 2022 Aalto University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
2 changes: 2 additions & 0 deletions adminui/equivdemo.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// along with Stack. If not, see <http://www.gnu.org/licenses/>.

/**
* Add description here!
* @package qtype_stack
* @copyright 2016 University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
1 change: 1 addition & 0 deletions adminui/healthcheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* all the parts are working properly, including the conection to the CAS,
* graph plotting, and equation rendering.
*
* @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
1 change: 1 addition & 0 deletions adminui/replacedollars.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* from this script can overload your web browser. In that case, there
* is an un-documented feature. Add preview=0 at the end of the URL.
*
* @package qtype_stack
* @copyright 2012 the Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
1 change: 1 addition & 0 deletions adminui/replacedollarsindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
/**
* This script lets the user create or edit question tests for a question.
*
* @package qtype_stack
* @copyright 2012 the Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
1 change: 1 addition & 0 deletions adminui/studentinputs.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
/**
* This script runs attempts to "validate" a list of potential answer strings from students and verifies the results.
*
* @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
1 change: 1 addition & 0 deletions adminui/subscripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* correctly, and second it serves to document the expected behaviour of answer
* tests, which is useful for learning how they work.
*
* @package qtype_stack
* @copyright 2012 University of Birmingham
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
3 changes: 2 additions & 1 deletion adminui/todo.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* This page lets the user find all questions in a course in which they are a techer
* which have a [[todo]] block. The questions are sorted by any tags they might have.
*
* @package qtype_stack
* @copyright 2024 University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down Expand Up @@ -81,7 +82,7 @@
$dashurl = html_writer::link(new moodle_url($questiontestsurl,
['questionid' => $qid]), $qname). ' ' .
$OUTPUT->action_icon($preurl, new pix_icon('t/preview', get_string('preview')));
// TODO: add in a direct edit URL.
// TO-DO: add in a direct edit URL.
$qtodos[] = ['qid' => $qid,
'qname' => $qname,
'tags' => $tags,
Expand Down
8 changes: 6 additions & 2 deletions api/config_sample.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see <http://www.gnu.org/licenses/>.

// @copyright 2023 RWTH Aachen
// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
/**
* Add description here!
* @package qtype_stack
* @copyright 2023 RWTH Aachen
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/

/**
* Simulating Moodle global configuration variables.
Expand Down
17 changes: 9 additions & 8 deletions api/controller/DownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see <http://www.gnu.org/licenses/>.

// This script handles file download from file download blocks.
//
// @copyright 2023 RWTH Aachen
// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
/**
* This script handles file download from file download blocks.
*
* @package qtype_stack
* @copyright 2023 RWTH Aachen
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/

namespace api\controller;
defined('MOODLE_INTERNAL') || die();
Expand All @@ -30,11 +33,9 @@
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class DownloadController {
/**
* @throws \stack_exception
* @throws \Exception
*/
// phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __invoke(Request $request, Response $response, array $args): Response {
// TO-DO: Validate.
$data = $request->getParsedBody();
Expand Down
18 changes: 10 additions & 8 deletions api/controller/GradingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see <http://www.gnu.org/licenses/>.

// This script handles the various deploy/undeploy actions from questiontestrun.php.
//
// @copyright 2023 RWTH Aachen
// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
/**
* This script handles the various deploy/undeploy actions from questiontestrun.php.
*
* @package qtype_stack
* @copyright 2023 RWTH Aachen
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/

namespace api\controller;
defined('MOODLE_INTERNAL') || die();
Expand All @@ -35,11 +38,9 @@
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class GradingController {
/**
* @throws \stack_exception
* @throws \Exception
*/
// phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __invoke(Request $request, Response $response, array $args): Response {
// TO-DO: Validate.
$data = $request->getParsedBody();
Expand Down Expand Up @@ -156,6 +157,7 @@ public function __invoke(Request $request, Response $response, array $args): Res
return $response->withHeader('Content-Type', 'application/json');
}

// phpcs:ignore moodle.Commenting.MissingDocblock.Function
private function standard_prt_feedback(\qtype_stack_question $question, \prt_evaluatable $result, $feedbackstyle) {
$class = '';
if ($result->get_score() < 0.000001) {
Expand Down
17 changes: 9 additions & 8 deletions api/controller/RenderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see <http://www.gnu.org/licenses/>.

// This script handles the various deploy/undeploy actions from questiontestrun.php.
//
// @copyright 2023 RWTH Aachen
// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
/**
* This script handles the various deploy/undeploy actions from questiontestrun.php.
*
* @package qtype_stack
* @copyright 2023 RWTH Aachen
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/

namespace api\controller;
defined('MOODLE_INTERNAL') || die();
Expand All @@ -36,11 +39,9 @@
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class RenderController {
/**
* @throws \stack_exception
* @throws \Exception
*/
// phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __invoke(Request $request, Response $response, array $args): Response {
// TO-DO: Validate.
$data = $request->getParsedBody();
Expand Down
16 changes: 8 additions & 8 deletions api/controller/TestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see <http://www.gnu.org/licenses/>.

// This script handles the running of question tests for a supplied question
//
// @copyright 2024 University of Edinburgh
// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
/**
* This script handles the running of question tests for a supplied question
*
* @package qtype_stack
* @copyright 2024 University of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/

namespace api\controller;
defined('MOODLE_INTERNAL') || die();
Expand All @@ -40,10 +43,7 @@
* leaving display for the front end.
*/
class TestController {
/**
* @throws \stack_exception
* @throws \Exception
*/
// phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __invoke(Request $request, Response $response, array $args): Response {
// TO-DO: Validate.
$data = $request->getParsedBody();
Expand Down
17 changes: 9 additions & 8 deletions api/controller/ValidationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see <http://www.gnu.org/licenses/>.

// This script handles the various deploy/undeploy actions from questiontestrun.php.
//
// @copyright 2023 RWTH Aachen
// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
/**
* This script handles the various deploy/undeploy actions from questiontestrun.php.
*
* @package qtype_stack
* @copyright 2023 RWTH Aachen
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/

namespace api\controller;
defined('MOODLE_INTERNAL') || die();
Expand All @@ -33,11 +36,9 @@
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;

// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class ValidationController {
/**
* @throws \stack_exception
* @throws \Exception
*/
// phpcs:ignore moodle.Commenting.MissingDocblock.Function
public function __invoke(Request $request, Response $response, array $args): Response {
// TO-DO: Validate.
$data = $request->getParsedBody();
Expand Down
17 changes: 11 additions & 6 deletions api/dtos/StackGradingResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see <http://www.gnu.org/licenses/>.

// This script handles the various deploy/undeploy actions from questiontestrun.php.
//
// @copyright 2023 RWTH Aachen
// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
/**
* This script handles the various deploy/undeploy actions from questiontestrun.php.
*
* @package qtype_stack
* @copyright 2023 RWTH Aachen
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/

namespace api\dtos;

// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class StackGradingResponse {
/** @var bool */
public $isgradable;
Expand All @@ -34,9 +38,10 @@ class StackGradingResponse {
public $specificfeedback;
/** @var array */
public $prts;
// phpcs:ignore moodle.Commenting.VariableComment.Missing
public $gradingassets;
/** @var string */
public $responsesummary;
/** @var string */
public $responsesummary;
/** @var array */
public $iframes;

Expand Down
15 changes: 11 additions & 4 deletions api/dtos/StackRenderResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,26 @@
// You should have received a copy of the GNU General Public License
// along with Stack. If not, see <http://www.gnu.org/licenses/>.

// This script handles the various deploy/undeploy actions from questiontestrun.php.
//
// @copyright 2023 RWTH Aachen
// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
/**
* This script handles the various deploy/undeploy actions from questiontestrun.php.
*
* @package qtype_stack
* @copyright 2023 RWTH Aachen
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/

namespace api\dtos;
defined('MOODLE_INTERNAL') || die();

// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class StackRenderResponse {
/** @var string */
public $questionrender;
/** @var string */
public $questionsamplesolutiontext;
/** @var StackRenderInput[] */
public $questioninputs;
// phpcs:ignore moodle.Commenting.VariableComment.Missing
public $questionassets;
/** @var int */
public $questionseed;
Expand All @@ -38,9 +43,11 @@ class StackRenderResponse {
public $iframes;
}

// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class StackRenderInput {
/** @var int */
public $validationtype;
// phpcs:ignore moodle.Commenting.VariableComment.Missing
public $samplesolution;
/** @var string */
public $samplesolutionrender;
Expand Down
2 changes: 2 additions & 0 deletions api/dtos/StackTestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
/**
* Response to a question test request
*
* @package qtype_stack
* @copyright 2024 Uuniversity of Edinburgh
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/

namespace api\dtos;

// phpcs:ignore moodle.Commenting.MissingDocblock.Class
class StackTestResponse {
/** @var string */
public $name = '';
Expand Down
Loading

0 comments on commit a71e1ed

Please sign in to comment.