Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
12 / 12 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
MMLmmultiscripts | |
100.00% |
12 / 12 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
newSubtree | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
3 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\Math\WikiTexVC\MMLnodes; |
4 | |
5 | /** |
6 | * Presentation MathML 3 Element |
7 | * name: "mmultiscripts" |
8 | * description: "?" |
9 | * category: "?" |
10 | */ |
11 | class MMLmmultiscripts extends MMLbase { |
12 | |
13 | public function __construct( string $texclass = "", array $attributes = [] ) { |
14 | parent::__construct( "mmultiscripts", $texclass, $attributes ); |
15 | } |
16 | |
17 | /** |
18 | * @param MMLbase $base Main element being annotated |
19 | * @param MMLbase|null $postsubscript Subscript placed after the base |
20 | * @param MMLbase|null $postsuperscript Superscript placed after the base |
21 | * @param MMLbase|null $presubscript Subscript placed before the base |
22 | * @param MMLbase|null $presuperscript Superscript placed before the base |
23 | * @param string $texclass Optional TeX class for styling |
24 | * @param array $attributes Additional HTML attributes for the element |
25 | * @return static New instance with children ordered as: |
26 | * [base, postsubscript, postsuperscript, presubscript, presuperscript] |
27 | */ |
28 | public static function newSubtree( |
29 | MMLbase $base, |
30 | ?MMLbase $postsubscript = null, |
31 | ?MMLbase $postsuperscript = null, |
32 | ?MMLbase $presubscript = null, |
33 | ?MMLbase $presuperscript = null, |
34 | string $texclass = "", |
35 | array $attributes = [] |
36 | ) { |
37 | $instance = new self( $texclass, $attributes ); |
38 | $children = [ $base ]; |
39 | // Handle postscripts (must come in pairs) |
40 | $children[] = $postsubscript; |
41 | $children[] = $postsuperscript; |
42 | // Handle prescripts (requires mprescripts marker) |
43 | $hasPre = $presubscript || $presuperscript; |
44 | if ( $hasPre ) { |
45 | $children[] = new MMLmprescripts(); |
46 | $children[] = $presubscript; |
47 | $children[] = $presuperscript; |
48 | } |
49 | $instance->children = $children; |
50 | return $instance; |
51 | } |
52 | } |