Archived
1
0
Fork 0
This repository has been archived on 2026-05-10. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
fiktivkod/application/models/BlogPost.php
2010-09-11 21:49:06 +02:00

98 lines
No EOL
1.6 KiB
PHP

<?php
class BlogPost
{
protected $_title;
protected $_content;
protected $_author;
protected $_pubDate;
protected $_isPublished = false;
public function getTitle()
{
return $this->_title;
}
public function setTitle($title)
{
if (is_string($title) && null == $title[30]) {
$this->_title = $title;
return true;
}
return false;
}
public function getContent()
{
return $this->_content;
}
public function setContent($content)
{
if (is_string($content)) {
$this->_content = $content;
return true;
}
return false;
}
public function getAuthor()
{
return $this->_author;
}
public function setAuthor($author)
{
if ($author instanceof User) {
$this->_author = $author;
return true;
}
return false;
}
public function getPubDate()
{
return $this->_pubDate;
}
public function setPubDate($date)
{
if (Fiktiv_Date::isDate($date)) {
$this->_pubDate = new Fiktiv_Date($date);
} else if ($date instanceof Zend_Date) {
$this->_pubDate = $date;
} else {
return false;
}
return true;
}
public function isPublished($flag = null)
{
if (null === $flag) {
return $this->_isPublished;
}
$this->_isPublished = (boolean)$flag;
}
}