Failed Conditions
Push — psr2 ( de3699...36dc94 )
by Andreas
06:50 queued 03:31
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
nc 1
dl 0
loc 10
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 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