BlogEntry::getExcerpt()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Lichtenwallner  (https://lichtenwallner.at)
4
 *
5
 * @see https://github.com/jolicht/markdown-cms for the canonical source repository
6
 * @license https://github.com/jolicht/markdown-cms/blob/master/LICENSE MIT
7
 * @copyright Copyright (c) Johannes Lichtenwallner
8
 */
9
declare(strict_types = 1);
10
namespace Jolicht\MarkdownCms\ContentType;
11
12
use Jolicht\MarkdownCms\Taxonomy\Tag;
13
14
/**
15
 * Blog entry
16
 */
17
class BlogEntry extends AbstractContentType implements ContentTypeInterface
18
{
19
    /**
20
     * Excerpt
21
     *
22
     * @var string
23
     */
24
    private $excerpt;
25
26
    /**
27
     * Exends
28
     *
29
     * @var string
30
     */
31
    private $extend;
32
33
    /**
34
     * Tags
35
     *
36
     * @var array
37
     */
38
    private $tags = [];
39
40
    /**
41
     * Constructor
42
     *
43
     * @param string $id
44
     * @param string $title
45
     * @param string $content
46
     * @param \DateTime $created
47
     * @param \DateTime $updated
48
     * @param bool $draft
49
     * @param string $template
50
     * @param string $excerpt
51
     * @param string $extend
52
     */
53
    public function __construct(string $id, string $title, string $content, \DateTime $created, \DateTime $updated,
54
        bool $draft, string $template, string $excerpt, string $extend)
55
    {
56
        parent::__construct($id, $title, $content, $created, $updated, $draft, $template);
57
        $this->excerpt = $excerpt;
58
        $this->extend = $extend;
59
    }
60
61
    /**
62
     * Get excerpt
63
     *
64
     * @return string
65
     */
66
    public function getExcerpt() : string
67
    {
68
        return $this->excerpt;
69
    }
70
71
    /**
72
     * Get extend
73
     *
74
     * @return string
75
     */
76
    public function getExtend() : string
77
    {
78
        return $this->extend;
79
    }
80
81
    /**
82
     * Get tags
83
     *
84
     * @return array
85
     */
86
    public function getTags() : array
87
    {
88
        return $this->tags;
89
    }
90
91
    /**
92
     * Add tag
93
     *
94
     * @param Tag $tag
95
     */
96
    public function addTag(Tag $tag)
97
    {
98
        $this->tags[] = $tag;
99
    }
100
101
    /**
102
     * Get type
103
     *
104
     * {@inheritDoc}
105
     * @see \Jolicht\MarkdownCms\ContentType\AbstractContentType::getType()
106
     */
107
    public function getType() : string
108
    {
109
        return 'blogEntry';
110
    }
111
}