Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
95.45% covered (success)
95.45%
21 / 22
90.00% covered (success)
90.00%
9 / 10
CRAP
0.00% covered (danger)
0.00%
0 / 1
Fun4
95.45% covered (success)
95.45%
21 / 22
90.00% covered (success)
90.00%
9 / 10
11
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 getFname
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getArg1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getArg2
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getArg3
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getArg4
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 inCurlies
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 render
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 renderMML
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 extractIdentifiers
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare( strict_types = 1 );
4
5namespace MediaWiki\Extension\Math\WikiTexVC\Nodes;
6
7class Fun4 extends TexNode {
8
9    /** @var string */
10    protected $fname;
11    /** @var TexNode */
12    protected $arg1;
13    /** @var TexNode */
14    protected $arg2;
15    /** @var TexNode */
16    protected $arg3;
17    /** @var TexNode */
18    protected $arg4;
19
20    public function __construct( string $fname,
21                                 TexNode $arg1,
22                                 TexNode $arg2,
23                                 TexNode $arg3,
24                                 TexNode $arg4 ) {
25        parent::__construct( $fname, $arg1, $arg2, $arg3, $arg4 );
26        $this->fname = $fname;
27        $this->arg1 = $arg1;
28        $this->arg2 = $arg2;
29        $this->arg3 = $arg3;
30        $this->arg4 = $arg4;
31    }
32
33    /**
34     * @return string
35     */
36    public function getFname(): string {
37        return $this->fname;
38    }
39
40    /**
41     * @return TexNode
42     */
43    public function getArg1(): TexNode {
44        return $this->arg1;
45    }
46
47    /**
48     * @return TexNode
49     */
50    public function getArg2(): TexNode {
51        return $this->arg2;
52    }
53
54    /**
55     * @return TexNode
56     */
57    public function getArg3(): TexNode {
58        return $this->arg3;
59    }
60
61    /**
62     * @return TexNode
63     */
64    public function getArg4(): TexNode {
65        return $this->arg4;
66    }
67
68    public function inCurlies() {
69        return $this->render();
70    }
71
72    public function render() {
73        return '{' . $this->fname . ' ' .
74            $this->arg1->inCurlies() .
75            $this->arg2->inCurlies() .
76            $this->arg3->inCurlies() .
77            $this->arg4->inCurlies() .
78            '}';
79    }
80
81    public function renderMML( $arguments = [], $state = [] ): string {
82        return $this->parseToMML( $this->fname, $arguments, $state );
83    }
84
85    public function extractIdentifiers( $args = null ) {
86        if ( $args == null ) {
87            $args = [ $this->arg1, $this->arg2, $this->arg3, $this->arg4 ];
88        }
89        return parent::extractIdentifiers( $args );
90    }
91
92}