* @author Dennis Eichhorn * @copyright 2013 Dennis Eichhorn * @license OMS License 1.0 * @version 1.0.0 * @link http://orange-management.com */ declare(strict_types=1); namespace Modules\Editor\Models; use phpOMS\Contract\ArrayableInterface; /** * News article class. * * @category Module * @package Framework * @author OMS Development Team * @author Dennis Eichhorn * @license OMS License 1.0 * @link http://orange-management.com * @since 1.0.0 */ class EditorDoc implements ArrayableInterface, \JsonSerializable { /** * Article ID. * * @var int * @since 1.0.0 */ private $id = 0; /** * Title. * * @var string * @since 1.0.0 */ private $title = ''; /** * Content. * * @var string * @since 1.0.0 */ private $content = ''; /** * Unparsed. * * @var string * @since 1.0.0 */ private $plain = ''; /** * Doc path for organizing. * * @var string * @since 1.0.0 */ private $path = ''; /** * Created. * * @var \DateTime * @since 1.0.0 */ private $createdAt = null; /** * Creator. * * @var int * @since 1.0.0 */ private $createdBy = 0; /** * Constructor. * * @since 1.0.0 * @author Dennis Eichhorn */ public function __construct() { $this->createdAt = new \DateTime('NOW'); } /** * @return string * * @since 1.0.0 * @author Dennis Eichhorn */ public function getContent() : string { return $this->content; } /** * @param string $content * * @return void * * @since 1.0.0 * @author Dennis Eichhorn */ public function setContent(string $content) { $this->content = $content; } /** * @param string $plain * * @return void * * @since 1.0.0 * @author Dennis Eichhorn */ public function setPlain(string $plain) { $this->plain = $plain; } /** * @return string * * @since 1.0.0 * @author Dennis Eichhorn */ public function getPlain() : string { return $this->plain; } /** * @return \DateTime * * @since 1.0.0 * @author Dennis Eichhorn */ public function getCreatedAt() : \DateTime { return $this->createdAt; } /** * @return int * * @since 1.0.0 * @author Dennis Eichhorn */ public function getId() : int { return $this->id; } /** * @return int * * @since 1.0.0 * @author Dennis Eichhorn */ public function getCreatedBy() : int { return $this->createdBy; } /** * @param int $id * * @since 1.0.0 * @author Dennis Eichhorn */ public function setCreatedBy(int $id) { $this->createdBy = $id; } /** * @param \DateTime $createdAt * * @return void * * @since 1.0.0 * @author Dennis Eichhorn */ public function setCreatedAt(\DateTime $createdAt) { $this->createdAt = $createdAt; } /** * @return string * * @since 1.0.0 * @author Dennis Eichhorn */ public function getTitle() : string { return $this->title; } /** * @param string $title * * @return mixed * * @since 1.0.0 * @author Dennis Eichhorn */ public function setTitle(string $title) { $this->title = $title; } /** * @return string * * @since 1.0.0 * @author Dennis Eichhorn */ public function getPath() : string { return $this->path; } /** * @param string $path * * @return mixed * * @since 1.0.0 * @author Dennis Eichhorn */ public function setPath(string $path) { $this->path = $path; } public function toArray() : array { return [ 'id' => $this->id, 'title' => $this->title, 'plain' => $this->plain, 'content' => $this->content, 'createdAt' => $this->createdAt, 'createdBy' => $this->createdBy, ]; } public function __toString() { return json_encode($this->toArray()); } public function jsonSerialize() { return $this->toArray(); } }