| 1 |
<?php |
| 2 |
|
| 3 |
declare( strict_types = 1 ); |
| 4 |
|
| 5 |
namespace MediaWiki\Extension\Math\WikiTexVC\Nodes; |
| 6 |
|
| 7 |
class Fun2 extends TexNode { |
| 8 |
|
| 9 |
|
| 10 |
protected $fname; |
| 11 |
|
| 12 |
protected $arg1; |
| 13 |
|
| 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 |
|
| 25 |
|
| 26 |
public function getFname(): string { |
| 27 |
return $this->fname; |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
public function getArg1(): TexNode { |
| 34 |
return $this->arg1; |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
public function getArg2(): TexNode { |
| 41 |
return $this->arg2; |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
public function inCurlies() { |
| 46 |
return $this->render(); |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
public function render() { |
| 51 |
return '{' . $this->fname . ' ' . $this->arg1->inCurlies() . $this->arg2->inCurlies() . '}'; |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
public function renderMML( $arguments = [], &$state = [] ): string { |
| 56 |
return $this->parseToMML( $this->fname, $arguments, $state ); |
| 57 |
} |
| 58 |
|
| 59 |
|
| 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 |
} |