Failed Conditions
Push — psr2 ( de3699...36dc94 )
by Andreas
06:50 queued 03:31
created

Listblock::connectTo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
nc 1
dl 0
loc 8
c 0
b 0
f 0
cc 1
eloc 5
nop 1
rs 9.4285
1
<?php
2
3
namespace dokuwiki\ParserMode;
4
5
class Listblock extends AbstractMode
6
{
7
8
    /**
9
     * Listblock constructor.
10
     */
11
    public function __construct()
12
    {
13
        global $PARSER_MODES;
14
15
        $this->allowedModes = array_merge(
16
            $PARSER_MODES['formatting'],
17
            $PARSER_MODES['substition'],
18
            $PARSER_MODES['disabled'],
19
            $PARSER_MODES['protected']
20
        );
21
    }
22
23
    /** @inheritdoc */
24
    public function connectTo($mode)
25
    {
26
        $this->Lexer->addEntryPattern('[ \t]*\n {2,}[\-\*]', $mode, 'listblock');
27
        $this->Lexer->addEntryPattern('[ \t]*\n\t{1,}[\-\*]', $mode, 'listblock');
28
29
        $this->Lexer->addPattern('\n {2,}[\-\*]', 'listblock');
30
        $this->Lexer->addPattern('\n\t{1,}[\-\*]', 'listblock');
31
    }
32
33
    /** @inheritdoc */
34
    public function postConnect()
35
    {
36
        $this->Lexer->addExitPattern('\n', 'listblock');
37
    }
38
39
    /** @inheritdoc */
40
    public function getSort()
41
    {
42
        return 10;
43
    }
44
}
45