Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Article {
- const STATUS_DRAFT = 1;
- const STATUS_PUBLISHED = 2;
- private $status;
- private $publishDate;
- private $viewCount;
- private $title;
- private $id;
- public function __construct() {
- $this->status = static::STATUS_DRAFT;
- $this->viewCount = 0;
- }
- public function setId($id)
- {
- $this->id = $id;
- }
- public function setPublished(DateTime $date) {
- $this->status = static::STATUS_PUBLISHED;
- $this->publishDate = $date;
- }
- public function setStatus($status)
- {
- $this->status = $status;
- }
- public function setPublishDate(DateTIme $date)
- {
- $this->publishDate = $date;
- }
- public function setTitle($title)
- {
- $this->title = $title;
- }
- public function setContent($content)
- {
- $this->content = $content;
- }
- public function getStatus()
- {
- return $this->status;
- }
- public function getPublishDate()
- {
- return $this->publishDate;
- }
- public function getTitle()
- {
- return $this->title;
- }
- public function getContent()
- {
- return $this->content;
- }
- public function getId()
- {
- return $this->id;
- }
- public function toArray()
- {
- $out = array();
- foreach($this as $key => $value)
- {
- $out[$key] = $value;
- }
- return $out;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement