| 1 |
<?php |
| 2 |
|
| 3 |
declare( strict_types = 1 ); |
| 4 |
|
| 5 |
namespace MediaWiki\Extension\Math\WikiTexVC\Nodes; |
| 6 |
|
| 7 |
class Fun4 extends TexNode { |
| 8 |
|
| 9 |
|
| 10 |
protected $fname; |
| 11 |
|
| 12 |
protected $arg1; |
| 13 |
|
| 14 |
protected $arg2; |
| 15 |
|
| 16 |
protected $arg3; |
| 17 |
|
| 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 |
|
| 35 |
|
| 36 |
public function getFname(): string { |
| 37 |
return $this->fname; |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
public function getArg1(): TexNode { |
| 44 |
return $this->arg1; |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
public function getArg2(): TexNode { |
| 51 |
return $this->arg2; |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
public function getArg3(): TexNode { |
| 58 |
return $this->arg3; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
public function getArg4(): TexNode { |
| 65 |
return $this->arg4; |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
public function inCurlies() { |
| 70 |
return $this->render(); |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
public function render() { |
| 75 |
return '{' . $this->fname . ' ' . |
| 76 |
$this->arg1->inCurlies() . |
| 77 |
$this->arg2->inCurlies() . |
| 78 |
$this->arg3->inCurlies() . |
| 79 |
$this->arg4->inCurlies() . |
| 80 |
'}'; |
| 81 |
} |
| 82 |
|
| 83 |
|
| 84 |
public function renderMML( $arguments = [], &$state = [] ): string { |
| 85 |
return $this->parseToMML( $this->fname, $arguments, $state ); |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
public function extractIdentifiers( $args = null ) { |
| 90 |
if ( $args == null ) { |
| 91 |
$args = [ $this->arg1, $this->arg2, $this->arg3, $this->arg4 ]; |
| 92 |
} |
| 93 |
return parent::extractIdentifiers( $args ); |
| 94 |
} |
| 95 |
|
| 96 |
} |