protected function calculateFunctionNode(FunctionNode $functionNode)
    {
        $nodes = $functionNode->getChildNodes();

        $arguments = [];
        $argumentChildNodes = [];

        foreach ($nodes as $node) {
            if (is_a($node, SymbolNode::class)) {
                /** @var SymbolNode $node */

                if (is_a($node->getSymbol(), AbstractSeparator::class)) {
                    $containerNode = new ContainerNode($argumentChildNodes);
                    $arguments[] = $this->calculateContainerNode($containerNode);
                    $argumentChildNodes = [];
                } else {
                    $argumentChildNodes[] = $node;
                }
            } else {
                $argumentChildNodes[] = $node;
            }
        }

        if (sizeof($argumentChildNodes) > 0) {
            $containerNode = new ContainerNode($argumentChildNodes);
            $arguments[] = $this->calculateContainerNode($containerNode);
        }

        /** @var AbstractFunction $symbol */
        $symbol = $functionNode->getSymbolNode()->getSymbol();

        $result = $symbol->execute($arguments);

        return $result;
    }
protected function calculateFunctionNode(FunctionNode $functionNode)
    {
        $nodes = $functionNode->getChildNodes();

        $arguments = [];
        $argumentChildNodes = [];

        foreach ($nodes as $node) {
            if (is_a($node, SymbolNode::class)) {
                /** @var SymbolNode $node */

                if (is_a($node->getSymbol(), AbstractSeparator::class)) {
                    $containerNode = new ContainerNode($argumentChildNodes);
                    $arguments[] = $this->calculateContainerNode($containerNode);
                    $argumentChildNodes = [];
                } else {
                    $argumentChildNodes[] = $node;
                }
            } else {
                $argumentChildNodes[] = $node;
            }
        }

        if (sizeof($argumentChildNodes) > 0) {
            $containerNode = new ContainerNode($argumentChildNodes);
            $arguments[] = $this->calculateContainerNode($containerNode);
        }

        /** @var AbstractFunction $symbol */
        $symbol = $functionNode->getSymbolNode()->getSymbol();

        $result = $symbol->execute($arguments);

        return $result;
    }
protected function calculateFunctionNode ( FunctionNode $ functionNode ) { $ nodes = $ functionNode -> getChildNodes ( ) ; $ arguments = [ ] ; $ argumentChildNodes = [ ] ; foreach ( $ nodes as $ node ) { if ( is_a ( $ node , SymbolNode :: class ) ) { /** @var SymbolNode $node */ if ( is_a ( $ node -> getSymbol ( ) , AbstractSeparator :: class ) ) { $ containerNode = new ContainerNode ( $ argumentChildNodes ) ; $ arguments [ ] = $ this -> calculateContainerNode ( $ containerNode ) ; $ argumentChildNodes = [ ] ; } else { $ argumentChildNodes [ ] = $ node ; } } else { $ argumentChildNodes [ ] = $ node ; } } if ( sizeof ( $ argumentChildNodes ) > 0 ) { $ containerNode = new ContainerNode ( $ argumentChildNodes ) ; $ arguments [ ] = $ this -> calculateContainerNode ( $ containerNode ) ; } /** @var AbstractFunction $symbol */ $ symbol = $ functionNode -> getSymbolNode ( ) -> getSymbol ( ) ; $ result = $ symbol -> execute ( $ arguments ) ; return $ result ; }
Returns the numeric value of a function node.

@param FunctionNode $functionNode
@return int|float
Returns the numeric value of a function node .