Dashboard Fach hinzufügen funktioniert in swe-b1-a-dev
This commit is contained in:
committed by
Matthias Grief
parent
a04936f59e
commit
77e91ae393
48
swe-b1-a-dev/webseite/classes/Task.php
Normal file
48
swe-b1-a-dev/webseite/classes/Task.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
class Task
|
||||
{
|
||||
/**
|
||||
* @var string Aufgabentext kann z.B. auch LaTeX-Notation enthalten
|
||||
*/
|
||||
private string $text;
|
||||
|
||||
/**
|
||||
* @var array Alle verwendeten Variablen mit key als Variable und value als richtigen Wert
|
||||
*/
|
||||
private array $variables;
|
||||
|
||||
/**
|
||||
* Erstellt eine neue Aufgabe
|
||||
* @param string $text Aufgabentext, kann z.B. auch LaTeX-Notation enthalten
|
||||
* @param array $variables Assoziatives Array mit Variable → Richtiger Wert
|
||||
*/
|
||||
public function __construct(string $text, array $variables)
|
||||
{
|
||||
$this->text = $text;
|
||||
$this->variables = array();
|
||||
foreach ($variables as $variable => $value) {
|
||||
if(!is_string($value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->variables[$variable] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string Aufgabentext
|
||||
*/
|
||||
public function getText(): string
|
||||
{
|
||||
return $this->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array Assoziatives Array mit Variable → Richtiger Wert
|
||||
*/
|
||||
public function getVariables(): array
|
||||
{
|
||||
return $this->variables;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user