HardBreakNode   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 41
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A increaseMark() 0 3 1
A __construct() 0 4 1
A getStartingNodeMarkScore() 0 3 1
A toSyntax() 0 3 1
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