diff --git a/Models/Issue.php b/Models/Issue.php index 522f9ac..349c792 100644 --- a/Models/Issue.php +++ b/Models/Issue.php @@ -51,10 +51,20 @@ class Issue /** * Created. * - * @var null|\DateTime + * @var \DateTime * @since 1.0.0 */ - private ?\DateTime $created = null; + private \DateTime $created; + + /** + * Constructor. + * + * @since 1.0.0 + */ + public function __construct() + { + $this->created = new \DateTime('now'); + } /** * Creator. @@ -64,77 +74,93 @@ class Issue */ private ?int $creator = null; - private static $instances = []; - - public function getInstance($id) - { - if (!isset(self::$instances[$id])) { - self::$instances[$id] = new self($id); - } - - return self::$instances[$id]; - } - - public function init($id) : void - { - } - - public function __clone() - { - } - - public function getId() + /** + * Get id. + * + * @return int + * + * @since 1.0.0 + */ + public function getId() : int { return $this->id; } - public function getName() + /** + * Get name/title + * + * @return string + * + * @since 1.0.0 + */ + public function getName() : string { return $this->name; } - public function setName($name) : void + /** + * Set name/title + * + * @param string $name Name/title + * + * @return void + * + * @since 1.0.0 + */ + public function setName(string $name) : void { $this->name = $name; } - public function getCreated() + /** + * Get created. + * + * @return \DateTime + * + * @since 1.0.0 + */ + public function getCreated() : \DateTime { return $this->created; } + /** + * Set created. + * + * @param \DateTime $created Date of when the article got created + * + * @return void + * + * @since 1.0.0 + */ public function setCreated($created) : void { $this->created = $created; } + /** + * Get creator. + * + * @return mixed + * + * @since 1.0.0 + */ public function getCreator() { return $this->creator; } + /** + * Set creator. + * + * @param mixed $creator Creator + * + * @return void + * + * @since 1.0.0 + */ public function setCreator($creator) : void { $this->creator = $creator; } - - public function delete() : void - { - } - - public function create() : void - { - } - - public function update() : void - { - } - - public function serialize() : void - { - } - - public function unserialize($data) : void - { - } } diff --git a/Models/Message.php b/Models/Message.php index 275e83d..be2bbcd 100644 --- a/Models/Message.php +++ b/Models/Message.php @@ -44,10 +44,10 @@ class Message /** * Created. * - * @var null|\DateTime + * @var \DateTime * @since 1.0.0 */ - private ?\DateTime $created = null; + private \DateTime $created; /** * Creator. @@ -57,95 +57,101 @@ class Message */ private ?int $creator = null; - private static $instances = []; - - public function getInstance($id) + /** + * Constructor. + * + * @since 1.0.0 + */ + public function __construct() { - if (!isset(self::$instances[$id])) { - self::$instances[$id] = new self($id); - } - - return self::$instances[$id]; + $this->created = new \DateTime('now'); } - public function getId() + /** + * Get id. + * + * @return int + * + * @since 1.0.0 + */ + public function getId() : int { return $this->id; } - public function getName() + /** + * Get name/title. + * + * @return string + * + * @since 1.0.0 + */ + public function getName() : string { return $this->name; } - public function setName($name) : void - { - $this->name = $name; - } - - public function getCreated() - { - return $this->created; - } - - public function setCreated($created) : void - { - $this->created = $created; - } - - public function getCreator() - { - return $this->creator; - } - - public function setCreator($creator) : void - { - $this->creator = $creator; - } - - public function delete() : void - { - } - - public function create() : void - { - } - - public function update() : void - { - } - - public function serialize() : void - { - } - - public function unserialize($data) : void - { - } - /** - * Init object by ID. + * Set name. * - * This usually happens from DB or cache - * - * @param int $id Object ID + * @param string $name Name/title * * @return void * * @since 1.0.0 */ - public function init($id) : void + public function setName(string $name) : void { - // TODO: Implement init() method. + $this->name = $name; } /** - * Overwriting clone in order to maintain singleton pattern. + * Get created. + * + * @return \DateTime * * @since 1.0.0 */ - public function __clone() + public function getCreated() : \DateTime { - // TODO: Implement __clone() method. + return $this->created; + } + + /** + * Set created. + * + * @return void + * + * @since 1.0.0 + */ + public function setCreated($created) : void + { + $this->created = $created; + } + + /** + * Get creator. + * + * @return mixed + * + * @since 1.0.0 + */ + public function getCreator() + { + return $this->creator; + } + + /** + * Set creator. + * + * @param mixed $creator Creator + * + * @return void + * + * @since 1.0.0 + */ + public function setCreator($creator) : void + { + $this->creator = $creator; } } diff --git a/Models/Ticket.php b/Models/Ticket.php index 12fe49c..3a27f5d 100644 --- a/Models/Ticket.php +++ b/Models/Ticket.php @@ -60,11 +60,27 @@ class Ticket return $this->id; } + /** + * Get task. + * + * @return Task + * + * @since 1.0.0 + */ public function getTask() : Task { return $this->task; } + /** + * Set task. + * + * @param Task $task Task + * + * @return void + * + * @since 1.0.0 + */ public function setTask(Task $task) : void { $this->task = $task;