InlineNodeBuilder::mention()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DH\Adf\Builder;
6
7
use DH\Adf\Node\BlockNode;
8
use DH\Adf\Node\Inline\Emoji;
9
use DH\Adf\Node\Inline\Hardbreak;
10
use DH\Adf\Node\Inline\Mention;
11
use DH\Adf\Node\Node;
12
13
trait InlineNodeBuilder
14
{
15
    public function emoji(string $shortName, ?string $id = null, ?string $text = null): self
16
    {
17
        $emoji = new Emoji($shortName, $id, $text);
18
        $this->append($emoji);
19
20
        return $this;
21
    }
22
23
    public function mention(string $mentionId, string $text, ?string $accessLevel = null): self
24
    {
25
        $mention = new Mention($mentionId, $text, $accessLevel);
26
        $this->append($mention);
27
28
        return $this;
29
    }
30
31
    public function break(?Node $parent = null): self
32
    {
33
        $this->append(new Hardbreak($parent));
34
35
        return $this;
36
    }
37
38
    abstract public function append(Node ...$nodes): BlockNode;
39
}
40