Potential Produkt Increment #83
@@ -167,6 +167,36 @@ class SubjectData
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt ein neues Thema zum Fach hinzu
|
||||||
|
* @param TopicData $topic Das neue Thema
|
||||||
|
* @return bool true, wenn erfolgreich, sonst false
|
||||||
|
*/
|
||||||
|
public function addTopic(TopicData $topic): bool
|
||||||
|
{
|
||||||
|
if(isset($this->topics[$topic->getId()])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->topics[] = $topic;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entfernt ein Thema vom Fach
|
||||||
|
* @param TopicData $topic Das zu entfernende Thema
|
||||||
|
* @return bool true, wenn erfolgreich, sonst false
|
||||||
|
*/
|
||||||
|
public function removeTopic(TopicData $topic): bool
|
||||||
|
{
|
||||||
|
if(!isset($this->topics[$topic->getId()])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->topics = array_diff($this->topics, [$topic]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function getId(): string
|
public function getId(): string
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
|
|||||||
Reference in New Issue
Block a user