Article.php + getArticle Anpassungen

Article-Klasse ist nun syntaktisch korrekt.
getArticle gibt nun als Rückgabe einen Typ Article zurück
This commit is contained in:
2026-05-29 09:57:50 +02:00
parent 306b9e8152
commit c52834aa0d
4 changed files with 31 additions and 17 deletions
+12 -12
View File
@@ -23,10 +23,10 @@ class Article
* @param $content string Inhalt des Beitrags
* @param $author string der Autor des des Beitrages NID
* @param $category string Kategorie des Beitrages
* @param $creationDate
* @param $tags string[] optionale Schlagworte für eine bessere Suche
* @param $tags string optionale Schlagworte für eine bessere Suche
* @param $creationDate string Datum der Beitragserstellung
*/
public function __construct($id, $title, $content, $author, $creationDate, $category, array $tags)
public function __construct(int $id, string $title, string $content, string $author, string $category, string $tags, string $creationDate)
{
$this->id = $id;
$this->title = $title;
@@ -50,7 +50,7 @@ class Article
* Gibt den Titel eines Artikels zurück.
* @return string
*/
public function getTitle()
public function getTitle(): string
{
return $this->title;
}
@@ -70,7 +70,7 @@ class Article
* TODO: Content muss noch definiert werden.
* @return string
*/
public function getContent()
public function getContent(): string
{
return $this->content;
}
@@ -90,14 +90,14 @@ class Article
* Gibt den Autor eines Artikels zurück.
* @return string
*/
public function getAuthor()
public function getAuthor(): string
{
return $this->author;
}
/**
* Gibt das Veröffentlichungsdatum des Artikels zurück.
* @return mixed
* @return string
*/
public function getCreationDate()
{
@@ -108,25 +108,25 @@ class Article
* Gibt die Kategorie eines Artikels zurück.
* @return string
*/
public function getCategory()
public function getCategory(): string
{
return $this->category;
}
/**
* Gibt die Schlagworte eines Artikels zurück.
* @return string[]
* @return string
*/
public function getTags()
public function getTags(): string
{
return $this->tags;
}
/**
* Setzt die Schlagworte eines Artikels.
* @param string[] $tags
* @param string $tags
*/
public function setTags($tags)
public function setTags(string $tags)
{
$this->tags = $tags;
}