2015-04-22 18:24:10 +02:00
|
|
|
<?php namespace Todaymade\Daux\Tree;
|
|
|
|
|
2015-04-23 00:32:30 +02:00
|
|
|
class Content extends Entry
|
|
|
|
{
|
2015-07-17 23:38:06 +02:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $content;
|
2015-04-22 18:24:10 +02:00
|
|
|
|
2015-10-28 00:18:29 +01:00
|
|
|
/**
|
|
|
|
* @var Content
|
|
|
|
*/
|
|
|
|
protected $previous;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var Content
|
|
|
|
*/
|
|
|
|
protected $next;
|
|
|
|
|
2015-07-17 23:38:06 +02:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getContent()
|
|
|
|
{
|
|
|
|
if (!$this->content) {
|
|
|
|
$this->content = file_get_contents($this->getPath());
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->content;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $content
|
|
|
|
*/
|
|
|
|
public function setContent($content)
|
|
|
|
{
|
|
|
|
$this->content = $content;
|
|
|
|
}
|
2015-10-28 00:18:29 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Content
|
|
|
|
*/
|
|
|
|
public function getPrevious()
|
|
|
|
{
|
|
|
|
return $this->previous;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Content $previous
|
|
|
|
*/
|
|
|
|
public function setPrevious($previous)
|
|
|
|
{
|
|
|
|
$this->previous = $previous;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return Content
|
|
|
|
*/
|
|
|
|
public function getNext()
|
|
|
|
{
|
|
|
|
return $this->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Content $next
|
|
|
|
*/
|
|
|
|
public function setNext($next)
|
|
|
|
{
|
|
|
|
$this->next = $next;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function dump()
|
|
|
|
{
|
|
|
|
$dump = parent::dump();
|
|
|
|
|
|
|
|
$dump['prev'] = $this->getPrevious() ? $this->getPrevious()->getUrl() : '';
|
|
|
|
$dump['next'] = $this->getNext() ? $this->getNext()->getUrl() : '';
|
|
|
|
|
|
|
|
return $dump;
|
|
|
|
}
|
2015-04-22 18:24:10 +02:00
|
|
|
}
|