Files
2026-06-03 01:58:02 +02:00

147 lines
3.1 KiB
PHP

<?php
/**
* Klasse: Artikel
* Diese Klasse stellt alle Daten eines Beitrags (Beitrag) bereit
*
* @author Niklas Ortmann
*/
class Article
{
public $id;
public $title;
public $content;
public $author;
public $creationDate;
public $category;
public $tags;
/**
* Konstruktor
*
* @param $id integer ID des Beitrages
* @param $title string Titel des Beitrags
* @param $content string Inhalt des Beitrags
* @param $author string der Autor des des Beitrages NID
* @param $category string Kategorie des Beitrages
* @param $tags string optionale Schlagworte für eine bessere Suche
* @param $creationDate string Datum der Beitragserstellung
*/
public function __construct(int $id, string $title, string $content, string $author, string $category, string $tags, string $creationDate)
{
$this->id = $id;
$this->title = $title;
$this->content = $content;
$this->author = $author;
$this->creationDate = $creationDate;
$this->category = $category;
$this->tags = $tags;
}
/**
* Gibt die ID eines Beitrags zurück.
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* Gibt den Titel eines Beitrags zurück.
* @return string
*/
public function getTitle(): string
{
return $this->title;
}
/**
* Setzt den Titel eines Beitrags
* @param $title
* @return void
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* Gibt den Content eines Beitrags zurück.
* TODO: Content muss noch definiert werden.
* @return string
*/
public function getContent(): string
{
return $this->content;
}
/**
* Setzt den Content eines Beitrags.
* TODO: Content muss noch definiert werden.
* @param $content
* @return void
*/
public function setContent($content)
{
$this->content = $content;
}
/**
* Gibt den Autor eines Beitrags zurück.
* @return string
*/
public function getAuthor(): string
{
return $this->author;
}
/**
* Gibt das Veröffentlichungsdatum des Beitrags zurück.
* @return string
*/
public function getCreationDate(): string
{
return $this->creationDate;
}
/**
* Gibt die Kategorie eines Beitrags zurück.
* @return string
*/
public function getCategory(): string
{
return $this->category;
}
/**
* Setzt die Kategorie eines Beitrags.
* @param string $category
* @return void
*/
public function setCategory(string $category)
{
$this->category = $category;
}
/**
* Gibt die Schlagworte eines Beitrags zurück.
* @return string
*/
public function getTags(): string
{
return $this->tags;
}
/**
* Setzt die Schlagworte eines Beitrags.
* @param string $tags
*/
public function setTags(string $tags)
{
$this->tags = $tags;
}
}
?>