FootnoteNode   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 12
c 1
b 0
f 1
dl 0
loc 24
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A toSyntax() 0 7 2
1
<?php
2
3
namespace dokuwiki\plugin\prosemirror\parser;
4
5
class FootnoteNode extends Node
6
{
7
    /** @var TextNode[] */
8
    protected $subnodes = [];
9
10
    protected $parent;
11
12
    public function __construct($data, Node $parent)
13
    {
14
        $this->parent = &$parent;
15
        $json = $data['attrs']['contentJSON'];
16
        $contentDoc = json_decode($json, true);
17
        foreach ($contentDoc['content'] as $subnode) {
18
            $this->subnodes[] = self::getSubNode($subnode, $this);
19
        }
20
    }
21
22
    public function toSyntax()
23
    {
24
        $doc = '';
25
        foreach ($this->subnodes as $subnode) {
26
            $doc .= $subnode->toSyntax() . "\n\n";
27
        }
28
        return "((\n" . rtrim(ltrim($doc, "\n")) . "\n))";
29
    }
30
}
31