<?php

declare( strict_types = 1 );

namespace MediaWiki\Extension\Math\TexVC\Nodes;

class Fun1nb extends Fun1 {

	public function inCurlies() {
		return '{' . $this->render() . '}';
	}

	public function render() {
		return $this->fname . ' ' . $this->arg->inCurlies() . ' ';
	}

	public function renderMML( $arguments = [], $state = [] ): string {
		return $this->parseToMML( $this->fname, $arguments, null );
		// This is very preliminary and should most probably be synced with the mappings from time to time
		// this might move to Fun1.php
		/**
		 * $mrow = new MMLmrow();
		 * $mo = new MMLmo();
		 * switch($this->fname) {
		 * case "\\mathrm":
		 *
		 * $diff = $this->arg->getArg()->mmlSquash(true, false);
		 * if($diff<=0){
		 * $arguments = array_merge([ "mathvariant"=>"normal"], $arguments);
		 * }
		 * return $mrow->encapsulate($this->arg->renderMML($arguments));
		 *
		 * case "\\operatorname":
		 * // Very experimental rule here, squashed elements with 'd' are without args, others with 'd' have
		 * $diff = $this->arg->getArg()->mmlSquash(true, false);
		 * if($diff<=0){
		 * $arguments = array_merge(["data-mjx-texclass"=>"OP", "mathvariant"=>"normal"], $arguments);
		 * }
		 * return $this->arg->renderMML($arguments);
		 * };
		 * return parent::renderMML($arguments); // TODO: Change the autogenerated stub
		 */
	}
}
