. /** * Generator for the gradingforum_guide plugin. * * @package gradingform_guide * @category test * @copyright 2018 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace tests\gradingform_guide\generator; /** * Convenience class to create guide criterion. * * @package gradingform_guide * @copyright 2018 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class criterion { /** @var string $shortname A shortened name of the criterion. */ private $shortname; /** @var string $description A description of the criterion. */ private $description; /** @var string $descriptionmarkers A description of the criterion for markers. */ private $descriptionmarkers; /** @var float Maximum score */ private $maxscore = 0; /** * Constructor for this test_criterion object * * @param string $shortname The shortname for the criterion * @param string $description The description for the criterion * @param string $descriptionmarkers The description for the marker for this criterion * @param float $maxscore The maximum score possible for this criterion */ public function __construct(string $shortname, string $description, string $descriptionmarkers, float $maxscore) { $this->shortname = $shortname; $this->description = $description; $this->descriptionmarkers = $descriptionmarkers; $this->maxscore = $maxscore; } /** * Get the description for this criterion. * * @return string */ public function get_description(): string { return $this->description; } /** * Get the description for markers of this criterion. * * @return string */ public function get_descriptionmarkers(): string { return $this->descriptionmarkers; } /** * Get the shortname for this criterion. * * @return string */ public function get_shortname(): string { return $this->shortname; } /** * Get the maxscore for this criterion. * * @return float */ public function get_maxscore(): float { return $this->maxscore; } /** * Get all values in an array for use when creating a new guide. * * @param int $sortorder * @return array */ public function get_all_values(int $sortorder): array { return [ 'sortorder' => $sortorder, 'shortname' => $this->get_shortname(), 'description' => $this->get_description(), 'descriptionmarkers' => $this->get_descriptionmarkers(), 'maxscore' => $this->get_maxscore(), ]; } }