Failed Conditions
Push — psr2 ( de3699...36dc94 )
by Andreas
03:29
created

Table   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A connectTo() 0 5 1
A postConnect() 0 10 1
A getSort() 0 4 1
1
<?php
2
3
namespace dokuwiki\ParserMode;
4
5
class Table extends AbstractMode
6
{
7
8
    /**
9
     * Table 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\^', $mode, 'table');
27
        $this->Lexer->addEntryPattern('[\t ]*\n\|', $mode, 'table');
28
    }
29
30
    /** @inheritdoc */
31
    public function postConnect()
32
    {
33
        $this->Lexer->addPattern('\n\^', 'table');
34
        $this->Lexer->addPattern('\n\|', 'table');
35
        $this->Lexer->addPattern('[\t ]*:::[\t ]*(?=[\|\^])', 'table');
36
        $this->Lexer->addPattern('[\t ]+', 'table');
37
        $this->Lexer->addPattern('\^', 'table');
38
        $this->Lexer->addPattern('\|', 'table');
39
        $this->Lexer->addExitPattern('\n', 'table');
40
    }
41
42
    /** @inheritdoc */
43
    public function getSort()
44
    {
45
        return 60;
46
    }
47
}
48