for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Lichtenwallner (https://lichtenwallner.at)
*
* @see https://github.com/jolicht/markdown-cms for the canonical source repository
* @license https://github.com/jolicht/markdown-cms/blob/master/LICENSE MIT
* @copyright Copyright (c) Johannes Lichtenwallner
*/
declare(strict_types = 1);
namespace Jolicht\MarkdownCms\ContentType;
use Jolicht\MarkdownCms\Taxonomy\Tag;
* Blog entry
class BlogEntry extends Page
{
* More separator
* @var string
const MORE_SEPARATOR = '<!--more-->';
* Excerpt
private $excerpt;
* Exends
private $extend;
* Tags
* @var array
private $tags = [];
* Get excerpt
* @return string
public function getExcerpt() : string
if (null === $this->excerpt) {
$this->explodeContent($this->getContent());
}
return $this->excerpt;
* Get extend
public function getExtend() : string
return $this->extend;
* Get tags
* @return array
public function getTags() : array
return $this->tags;
* Add tag
* @param Tag $tag
public function addTag(Tag $tag)
$this->tags[] = $tag;
private function explodeContent(string $content)
if (false !== strpos($content, self::MORE_SEPARATOR)) {
$parts = explode(self::MORE_SEPARATOR, $content, 2);
$this->excerpt = trim($parts[0]);
$this->extend = trim($parts[1]);
} else {
$this->excerpt = '';
$this->extend = trim($content);