<?php namespace FaZeBook\Data; use DateTimeImmutable; class Post extends DataObject { /* ----- Author ----- */ public function getAuthor(): User { return new User($this->dbo->fetchAs('user')->author); } /* ----- Page User ----- */ public function getPageUser(): User { return new User($this->dbo->fetchAs('user')->pageUser); } /* ----- Time ----- */ public function getTime(): DateTimeImmutable { return new DateTimeImmutable('@' . $this->dbo->time); } /* ----- Gossip ----- */ public function isGossip(): bool { return $this->dbo->gossip; } public function setGossip($gossip) { $this->dbo->gossip = $gossip; $this->update(); } /* ----- Type ----- */ public function getType(): int { return $this->dbo->type; } public function setType(int $type) { $this->dbo->type = $type; $this->update(); } /* ----- Content ----- */ public function getContent(): string { return $this->dbo->content; } public function setContent(string $content) { $this->dbo->content = $content; $this->update(); } }