2015-04-22 18:24:10 +02:00
|
|
|
<?php namespace Todaymade\Daux\Tree;
|
|
|
|
|
|
|
|
use Todaymade\Daux\DauxHelper;
|
|
|
|
|
2015-04-23 00:32:30 +02:00
|
|
|
class Content extends Entry
|
|
|
|
{
|
2015-07-16 11:08:16 +02:00
|
|
|
protected $content;
|
2015-04-22 18:24:10 +02:00
|
|
|
|
2015-04-23 00:32:30 +02:00
|
|
|
public function __construct($path = '', $parents = array())
|
|
|
|
{
|
2015-04-22 18:24:10 +02:00
|
|
|
parent::__construct($path, $parents);
|
|
|
|
|
|
|
|
$this->value = $this->uri;
|
|
|
|
}
|
2015-07-16 11:08:16 +02:00
|
|
|
|
|
|
|
public function getContent()
|
|
|
|
{
|
|
|
|
if (!$this->content) {
|
|
|
|
$this->content = file_get_contents($this->getPath());
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->content;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setContent($content)
|
|
|
|
{
|
|
|
|
$this->content = $content;
|
|
|
|
}
|
2015-04-22 18:24:10 +02:00
|
|
|
|
2015-04-23 00:32:30 +02:00
|
|
|
protected function getFilename($file)
|
|
|
|
{
|
2015-04-23 21:04:00 +02:00
|
|
|
return DauxHelper::pathinfo($file)['filename'];
|
2015-04-22 18:24:10 +02:00
|
|
|
}
|
|
|
|
}
|