public function makeNode($leftOperand, $rightOperand)
    {
        if ($rightOperand === null) return $this->createUnaryMinusNode($leftOperand);

        $leftOperand = $this->sanitize($leftOperand);
        $rightOperand = $this->sanitize($rightOperand);

        $node = $this->numericTerms($leftOperand, $rightOperand);
        if ($node) return $node;

        if ($leftOperand->compareTo($rightOperand)) {
            return new IntegerNode(0);
        }

        return new ExpressionNode($leftOperand, '-', $rightOperand);
    }
public function makeNode($leftOperand, $rightOperand)
    {
        if ($rightOperand === null) return $this->createUnaryMinusNode($leftOperand);

        $leftOperand = $this->sanitize($leftOperand);
        $rightOperand = $this->sanitize($rightOperand);

        $node = $this->numericTerms($leftOperand, $rightOperand);
        if ($node) return $node;

        if ($leftOperand->compareTo($rightOperand)) {
            return new IntegerNode(0);
        }

        return new ExpressionNode($leftOperand, '-', $rightOperand);
    }
public function makeNode ( $ leftOperand , $ rightOperand ) { if ( $ rightOperand === null ) return $ this -> createUnaryMinusNode ( $ leftOperand ) ; $ leftOperand = $ this -> sanitize ( $ leftOperand ) ; $ rightOperand = $ this -> sanitize ( $ rightOperand ) ; $ node = $ this -> numericTerms ( $ leftOperand , $ rightOperand ) ; if ( $ node ) return $ node ; if ( $ leftOperand -> compareTo ( $ rightOperand ) ) { return new IntegerNode ( 0 ) ; } return new ExpressionNode ( $ leftOperand , '-' , $ rightOperand ) ; }
Create a Node representing 'leftOperand - rightOperand'

Using some simplification rules, create a NumberNode or ExpressionNode
giving an AST correctly representing 'rightOperand - leftOperand'.

### Simplification rules:

- To simplify the use of the function, convert integer params to NumberNodes
- If $rightOperand is null, return a unary minus node '-x' instead
- If $leftOperand and $rightOperand are both NumberNodes, return a single NumberNode containing their difference
- If $rightOperand is a NumberNode representing 0, return $leftOperand unchanged
- If $leftOperand and $rightOperand are equal, return '0'

@param Node|int|float $leftOperand Minuend
@param Node|int|float $rightOperand Subtrahend
@retval Node
Create a Node representing leftOperand - rightOperand