SmileyNode::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
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 3
dl 0
loc 7
rs 10
1
<?php
2
3
namespace dokuwiki\plugin\prosemirror\parser;
4
5
class SmileyNode extends Node implements InlineNodeInterface
6
{
7
    protected $parent;
8
    protected $data;
9
10
    /** @var TextNode */
11
    protected $textNode;
12
13
    public function __construct($data, Node $parent, Node $previous = null)
14
    {
15
        $this->parent = &$parent;
16
        $this->data = $data;
17
18
        // every inline node needs a TextNode to track marks
19
        $this->textNode = new TextNode(['marks' => $data['marks'] ?? null], $parent, $previous);
20
    }
21
22
    /**
23
     * Get the node's representation as DokuWiki Syntax
24
     *
25
     * @return string
26
     */
27
    public function toSyntax()
28
    {
29
        return $this->data['attrs']['syntax'];
30
    }
31
32
    /**
33
     * @param string $markType
34
     */
35
    public function increaseMark($markType)
36
    {
37
        return $this->textNode->increaseMark($markType);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->textNode->increaseMark($markType) targeting dokuwiki\plugin\prosemir...extNode::increaseMark() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
38
    }
39
40
    /**
41
     * @param string $markType
42
     * @return int|null
43
     * @throws \Exception
44
     */
45
    public function getStartingNodeMarkScore($markType)
46
    {
47
        return $this->textNode->getStartingNodeMarkScore($markType);
48
    }
49
}
50