HardBreakNode::getStartingNodeMarkScore()   A
last analyzed

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