Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
96.03% covered (success)
96.03%
266 / 277
50.00% covered (danger)
50.00%
5 / 10
CRAP
0.00% covered (danger)
0.00%
0 / 1
BlockLevelPass
96.03% covered (success)
96.03%
266 / 277
50.00% covered (danger)
50.00%
5 / 10
119
0.00% covered (danger)
0.00%
0 / 1
 doBlockLevels
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 hasOpenParagraph
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 closeParagraph
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
3
 getCommon
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
3
 openList
91.67% covered (success)
91.67%
11 / 12
0.00% covered (danger)
0.00%
0 / 1
5.01
 nextItem
91.67% covered (success)
91.67%
11 / 12
0.00% covered (danger)
0.00%
0 / 1
7.03
 closeList
90.91% covered (success)
90.91%
10 / 11
0.00% covered (danger)
0.00%
0 / 1
5.02
 execute
97.04% covered (success)
97.04%
131 / 135
0.00% covered (danger)
0.00%
0 / 1
54
 findColonNoLinks
95.51% covered (success)
95.51%
85 / 89
0.00% covered (danger)
0.00%
0 / 1
39
1<?php
2
3/**
4 * This is the part of the wikitext parser which handles automatic paragraphs
5 * and conversion of start-of-line prefixes to HTML lists.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * http://www.gnu.org/copyleft/gpl.html
21 *
22 * @file
23 * @ingroup Parser
24 * @internal
25 */
26class BlockLevelPass {
27    private $DTopen = false;
28    private $inPre = false;
29    private $lastParagraph = '';
30    private $lineStart;
31    private $text;
32
33    # State constants for the definition list colon extraction
34    private const COLON_STATE_TEXT = 0;
35    private const COLON_STATE_TAG = 1;
36    private const COLON_STATE_TAGSTART = 2;
37    private const COLON_STATE_CLOSETAG = 3;
38    private const COLON_STATE_TAGSLASH = 4;
39    private const COLON_STATE_COMMENT = 5;
40    private const COLON_STATE_COMMENTDASH = 6;
41    private const COLON_STATE_COMMENTDASHDASH = 7;
42    private const COLON_STATE_LC = 8;
43
44    /**
45     * Make lists from lines starting with ':', '*', '#', etc.
46     *
47     * @param string $text
48     * @param bool $lineStart Whether or not this is at the start of a line.
49     * @return string The lists rendered as HTML
50     * @internal
51     */
52    public static function doBlockLevels( $text, $lineStart ) {
53        $pass = new self( $text, $lineStart );
54        return $pass->execute();
55    }
56
57    /**
58     * @param string $text
59     * @param bool $lineStart
60     */
61    private function __construct( $text, $lineStart ) {