Passed
Pull Request — master (#2)
by Mark
02:03
created

syntax_plugin_description::getSort()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/*
3
 * @phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps
4
 * @noinspection AutoloadingIssuesInspection
5
 */
6
7
/**
8
 * Description plugin.
9
 *
10
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
11
 * @author     Matthias Schulte <[email protected]>
12
 * @author     Mark C. Prins <[email protected]>
13
 *
14
 */
15
16
use dokuwiki\Extension\SyntaxPlugin;
1 ignored issue
show
Bug introduced by
The type dokuwiki\Extension\SyntaxPlugin was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
18
class syntax_plugin_description extends SyntaxPlugin
19
{
20
21
    final  public function getType(): string
22
    {
23
        return 'substition';
24
    }
25
26
    final public function getPType(): string
27
    {
28
        return 'block';
29
    }
30
31
    final  public function getSort(): int
32
    {
33
        return 98;
34
    }
35
36
    final  public function connectTo($mode): void
37
    {
38
        $this->Lexer->addSpecialPattern('\{\{description>.+?\}\}', $mode, 'plugin_description');
39
    }
40
41
    final public function handle($match, $state, $pos, Doku_Handler $handler): array
1 ignored issue
show
Bug introduced by
The type Doku_Handler was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
42
    {
43
        $match = substr($match, 14, -2); // strip markup
44
        $match = hsc($match);
1 ignored issue
show
Bug introduced by
The function hsc was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

44
        $match = /** @scrutinizer ignore-call */ hsc($match);
Loading history...
45
46
        return array($match);
47
    }
48
49
    final public function render($format, Doku_Renderer $renderer, $data): bool
1 ignored issue
show
Bug introduced by
The type Doku_Renderer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
50
    {
51
        $description = $data[0];
52
        if (empty($description)) {
53
            return false;
54
        }
55
56
        if ($format === 'metadata') {
57
            $renderer->meta['plugin_description']['keywords'] = $description;
58
            return true;
59
        }
60
        return false;
61
    }
62
}
63