Files
webprogrammierung/php/model/Article.php
T
2026-05-27 16:03:56 +02:00

107 lines
2.2 KiB
PHP

<?php
/**
* Klasse: Artikel
* Diese Klasse stellt alle Daten eines Artikels (Beitrag) bereit
*
* @author Niklas Ortmann
*/
class Article
{
private $id;
private $title;
private $content;
private $author;
private $date;
private $category;
/**
* 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 $date
* @param $tags string[] optionale Schlagworte für eine bessere Suche
*/
public function __construct($id, $title, $content, $author, $date, $category, array $tags)
{
$this->id = $id;
$this->title = $title;
$this->content = $content;
$this->author = $author;
$this->date = $date;
$this->category = $category;
$this->tags = $tags;
}
/**
* Gibt die ID eines Artikels zurück.
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Gibt den Titel eines Artikels zurück.
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Setzt den Titel eines Artikels
* @param $title
* @return void
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* Gibt den Content eines Artikels zurück.
* TODO: Content muss noch definiert werden.
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* Setzt den Content eines Artikels.
* TODO: Content muss noch definiert werden.
* @param $content
* @return void
*/
public function setContent($content)
{
$this->content = $content;
}
/**
* Gibt den Autor eines Artikels zurück.
* @return string
*/
public function getAuthor()
{
return $this->author;
}
/**
* Gibt das Veröffentlichungsdatum des Artikels zurück.
* @return mixed
*/
public function getDate()
{
return $this->date;
}
}
?>