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

Quotes   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 47
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
B connectTo() 0 36 2
A getSort() 0 4 1
1
<?php
2
3
namespace dokuwiki\Parsing\ParserMode;
4
5
class Quotes extends AbstractMode
6
{
7
8
    /** @inheritdoc */
9
    public function connectTo($mode)
10
    {
11
        global $conf;
12
13
        $ws   =  '\s/\#~:+=&%@\-\x28\x29\]\[{}><"\'';   // whitespace
14
        $punc =  ';,\.?!';
15
16
        if ($conf['typography'] == 2) {
17
            $this->Lexer->addSpecialPattern(
18
                "(?<=^|[$ws])'(?=[^$ws$punc])",
19
                $mode,
20
                'singlequoteopening'
21
            );
22
            $this->Lexer->addSpecialPattern(
23
                "(?<=^|[^$ws]|[$punc])'(?=$|[$ws$punc])",
24
                $mode,
25
                'singlequoteclosing'
26
            );
27
            $this->Lexer->addSpecialPattern(
28
                "(?<=^|[^$ws$punc])'(?=$|[^$ws$punc])",
29
                $mode,
30
                'apostrophe'
31
            );
32
        }
33
34
        $this->Lexer->addSpecialPattern(
35
            "(?<=^|[$ws])\"(?=[^$ws$punc])",
36
            $mode,
37
            'doublequoteopening'
38
        );
39
        $this->Lexer->addSpecialPattern(
40
            "\"",
41
            $mode,
42
            'doublequoteclosing'
43
        );
44
    }
45
46
    /** @inheritdoc */
47
    public function getSort()
48
    {
49
        return 280;
50
    }
51
}
52