Tag::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
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\Taxonomy;
11
12
/**
13
 * Taxonomy for tagging blog entries
14
 */
15
class Tag
16
{
17
    /**
18
     * Id
19
     *
20
     * @var string
21
     */
22
    private $id;
23
24
    /**
25
     * Title
26
     *
27
     * @var string
28
     */
29
    private $title;
30
31
    /**
32
     * Constructor
33
     *
34
     * @param string $id
35
     * @param string $title
36
     */
37
    public function __construct(string $id, string $title = null)
38
    {
39
        $this->id = $id;
40
        $this->title = $title;
41
        if (null === $this->title) {
42
            $this->title = $id;
43
        }
44
    }
45
46
    /**
47
     * Get id
48
     *
49
     * @return string
50
     */
51
    public function getId() : string
52
    {
53
        return $this->id;
54
    }
55
56
    /**
57
     * Get title
58
     *
59
     * @return string
60
     */
61
    public function getTitle() : string
62
    {
63
        return $this->title;
64
    }
65
}