Failed Conditions
Push — master ( 77bf62...d4f6a7 )
by Andreas
03:22 queued 10s
created

Doku_Parser::__get()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 1
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
use dokuwiki\Debug\PropertyDeprecationHelper;
4
5
/**
6
 * Define various types of modes used by the parser - they are used to
7
 * populate the list of modes another mode accepts
8
 */
9
global $PARSER_MODES;
10
$PARSER_MODES = array(
11
    // containers are complex modes that can contain many other modes
12
    // hr breaks the principle but they shouldn't be used in tables / lists
13
    // so they are put here
14
    'container' => array('listblock', 'table', 'quote', 'hr'),
15
16
    // some mode are allowed inside the base mode only
17
    'baseonly' => array('header'),
18
19
    // modes for styling text -- footnote behaves similar to styling
20
    'formatting' => array(
21
        'strong', 'emphasis', 'underline', 'monospace',
22
        'subscript', 'superscript', 'deleted', 'footnote'
23
    ),
24
25
    // modes where the token is simply replaced - they can not contain any
26
    // other modes
27
    'substition' => array(
28
        'acronym', 'smiley', 'wordblock', 'entity',
29
        'camelcaselink', 'internallink', 'media',
30
        'externallink', 'linebreak', 'emaillink',
31
        'windowssharelink', 'filelink', 'notoc',
32
        'nocache', 'multiplyentity', 'quotes', 'rss'
33
    ),
34
35
    // modes which have a start and end token but inside which
36
    // no other modes should be applied
37
    'protected' => array('preformatted', 'code', 'file', 'php', 'html', 'htmlblock', 'phpblock'),
38
39
    // inside this mode no wiki markup should be applied but lineendings
40
    // and whitespace isn't preserved
41
    'disabled' => array('unformatted'),
42
43
    // used to mark paragraph boundaries
44
    'paragraphs' => array('eol')
45
);
46
47
/**
48
 * Class Doku_Parser
49
 *
50
 * @deprecated 2018-05-04
51
 */
52
class Doku_Parser extends \dokuwiki\Parsing\Parser {
53
    use PropertyDeprecationHelper {
54
        __set as protected deprecationHelperMagicSet;
55
        __get as protected deprecationHelperMagicGet;
56
    }
57
58
    /** @inheritdoc */
59
    public function __construct(Doku_Handler $handler = null) {
60
        dbg_deprecated(\dokuwiki\Parsing\Parser::class);
61
        $this->deprecatePublicProperty('modes', __CLASS__);
62
        $this->deprecatePublicProperty('connected', __CLASS__);
63
64
        if ($handler === null) {
65
            $handler = new Doku_Handler();
66
        }
67
68
        parent::__construct($handler);
69
    }
70
71
    public function __set($name, $value)
72
    {
73
74
        if ($name === 'Handler') {
75
            $this->handler = $value;
76
            return;
77
        }
78
79
        if ($name === 'Lexer') {
80
            $this->lexer = $value;
81
            return;
82
        }
83
84
        $this->deprecationHelperMagicSet($name, $value);
85
    }
86
87
    public function __get($name)
88
    {
89
        if ($name === 'Handler') {
90
            return $this->handler;
91
        }
92
93
        if ($name === 'Lexer') {
94
            return $this->lexer;
95
        }
96
97
        return $this->deprecationHelperMagicGet($name);
98
    }
99
}
100