Passed
Push — main ( 29a37d...09a857 )
by Damien
07:06
created

InlineNodeBuilder::break()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
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 1
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DH\Adf\Builder;
6
7
use DH\Adf\Node\Inline\Emoji;
8
use DH\Adf\Node\Inline\Hardbreak;
9
use DH\Adf\Node\Inline\Mention;
10
use DH\Adf\Node\Node;
11
12
trait InlineNodeBuilder
13
{
14
    public function emoji(string $shortName, ?string $id = null, ?string $text = null): self
15
    {
16
        $emoji = new Emoji($shortName, $id, $text);
17
        $this->append($emoji);
18
19
        return $this;
20
    }
21
22
    public function mention(string $mentionId, string $text, ?string $accessLevel = null): self
23
    {
24
        $mention = new Mention($mentionId, $text, $accessLevel);
25
        $this->append($mention);
26
27
        return $this;
28
    }
29
30
    public function break(?Node $parent = null): self
31
    {
32
        $this->append(new Hardbreak($parent));
33
        
34
        return $this;
35
    }
36
37
    abstract protected function append(Node $node): void;
38
}
39