Passed
Push — master ( 1d6eae...926530 )
by
unknown
08:53
created

HardBreakNode::getStartingNodeMarkScore()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * Created by IntelliJ IDEA.
4
 * User: michael
5
 * Date: 1/25/18
6
 * Time: 11:15 AM
7
 */
8
9
namespace dokuwiki\plugin\prosemirror\parser;
10
11
class HardBreakNode extends Node implements InlineNodeInterface
12
{
13
    /** @var TextNode */
14
    protected $textNode;
15
16
    /**
17
     * HardBreakNode constructor.
18
     *
19
     * This is just a hard break, it doesn't have attributes or context
20
     *
21
     * @param      $data
22
     * @param Node $parent
23
     * @param Node|null $previous
24
     */
25
    public function __construct($data, Node $parent, Node $previous = null)
26
    {
27
        // every inline node needs a TextNode to track marks
28
        $this->textNode = new TextNode(['marks' => $data['marks']], $parent, $previous);
29
    }
30
31
    public function toSyntax()
32
    {
33
        return '\\\\ ';
34
    }
35
36
    /**
37
     * @param string $markType
38
     */
39
    public function increaseMark($markType)
40
    {
41
        $this->textNode->increaseMark($markType);
42
    }
43
44
    /**
45
     * @param string $markType
46
     * @return int|null
47
     * @throws \Exception
48
     */
49
    public function getStartingNodeMarkScore($markType)
50
    {
51
        return $this->textNode->getStartingNodeMarkScore($markType);
52
    }
53
}
54