Passed
Push — main ( 16e3d2...2668c7 )
by Damien
07:42
created

TextExporter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 14
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A export() 0 12 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DH\Adf\Exporter\Html\Inline;
6
7
use DH\Adf\Exporter\Html\HtmlExporter;
8
use DH\Adf\Node\Inline\Text;
9
10
class TextExporter extends HtmlExporter
11
{
12
    public function export(): string
13
    {
14
        \assert($this->node instanceof Text);
15
        $output = $this->node->getText();
0 ignored issues
show
Bug introduced by
The method getText() does not exist on DH\Adf\Node\Node. It seems like you code against a sub-type of DH\Adf\Node\Node such as DH\Adf\Node\Inline\Status or DH\Adf\Node\Inline\Mention or DH\Adf\Node\Inline\Text or DH\Adf\Node\Inline\Emoji. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

15
        /** @scrutinizer ignore-call */ 
16
        $output = $this->node->getText();
Loading history...
16
17
        foreach ($this->node->getMarks() as $mark) {
0 ignored issues
show
Bug introduced by
The method getMarks() does not exist on DH\Adf\Node\Node. It seems like you code against a sub-type of DH\Adf\Node\Node such as DH\Adf\Node\Inline\Text. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        foreach ($this->node->/** @scrutinizer ignore-call */ getMarks() as $mark) {
Loading history...
18
            $class = self::NODE_MAPPING[$mark::class];
19
            $exporter = new $class($mark, $output);
20
            $output = $exporter->export();
21
        }
22
23
        return $output;
24
    }
25
}
26