Failed Conditions
Push — psr2 ( e9eace...d4d8fb )
by Andreas
14:17 queued 07:54
created

Preformatted::connectTo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace dokuwiki\Parsing\ParserMode;
4
5
class Preformatted extends AbstractMode
6
{
7
8
    /** @inheritdoc */
9
    public function connectTo($mode)
10
    {
11
        // Has hard coded awareness of lists...
12
        $this->Lexer->addEntryPattern('\n  (?![\*\-])', $mode, 'preformatted');
13
        $this->Lexer->addEntryPattern('\n\t(?![\*\-])', $mode, 'preformatted');
14
15
        // How to effect a sub pattern with the Lexer!
16
        $this->Lexer->addPattern('\n  ', 'preformatted');
17
        $this->Lexer->addPattern('\n\t', 'preformatted');
18
    }
19
20
    /** @inheritdoc */
21
    public function postConnect()
22
    {
23
        $this->Lexer->addExitPattern('\n', 'preformatted');
24
    }
25
26
    /** @inheritdoc */
27
    public function getSort()
28
    {
29
        return 20;
30
    }
31
}
32