SmileyNode   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

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

4 Methods

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