Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
92.31% |
12 / 13 |
|
87.50% |
7 / 8 |
CRAP | |
0.00% |
0 / 1 |
| Fun2 | |
92.31% |
12 / 13 |
|
87.50% |
7 / 8 |
9.04 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| getFname | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getArg1 | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getArg2 | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| inCurlies | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| render | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toMMLTree | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| extractIdentifiers | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare( strict_types = 1 ); |
| 4 | |
| 5 | namespace MediaWiki\Extension\Math\WikiTexVC\Nodes; |
| 6 | |
| 7 | class Fun2 extends TexNode { |
| 8 | |
| 9 | /** @var string */ |
| 10 | protected $fname; |
| 11 | /** @var TexNode */ |
| 12 | protected $arg1; |
| 13 | /** @var TexNode */ |
| 14 | protected $arg2; |
| 15 | |
| 16 | public function __construct( string $fname, TexNode $arg1, TexNode $arg2 ) { |
| 17 | parent::__construct( $fname, $arg1, $arg2 ); |
| 18 | $this->fname = $fname; |
| 19 | $this->arg1 = $arg1; |
| 20 | $this->arg2 = $arg2; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * @return string |
| 25 | */ |
| 26 | public function getFname(): string { |
| 27 | return $this->fname; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * @return TexNode |
| 32 | */ |
| 33 | public function getArg1(): TexNode { |
| 34 | return $this->arg1; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * @return TexNode |
| 39 | */ |
| 40 | public function getArg2(): TexNode { |
| 41 | return $this->arg2; |
| 42 | } |
| 43 | |
| 44 | /** @inheritDoc */ |
| 45 | public function inCurlies() { |
| 46 | return $this->render(); |
| 47 | } |
| 48 | |
| 49 | /** @inheritDoc */ |
| 50 | public function render() { |
| 51 | return '{' . $this->fname . ' ' . $this->arg1->inCurlies() . $this->arg2->inCurlies() . '}'; |
| 52 | } |
| 53 | |
| 54 | /** @inheritDoc */ |
| 55 | public function toMMLTree( array $arguments = [], array &$state = [] ) { |
| 56 | return $this->parseToMML( $this->fname, $arguments, $state ); |
| 57 | } |
| 58 | |
| 59 | /** @inheritDoc */ |
| 60 | public function extractIdentifiers( $args = null ) { |
| 61 | if ( $args == null ) { |
| 62 | $args = [ $this->arg1, $this->arg2 ]; |
| 63 | } |
| 64 | return parent::extractIdentifiers( $args ); |
| 65 | } |
| 66 | |
| 67 | } |