protected function getGroupNodeClosingIndex(array $expression)
    {
        $parenthesis = 1;
        $index = 0;

        while ($parenthesis > 0) {
            $index++;
            if ($index > count($expression)) {
                $this->addError('Parenthesis not correctly closed.', self::ERROR_CODE_CLOSING_PARENTHESIS_NOT_FOUND);
            }

            if ('(' === $expression[$index]) {
                $parenthesis++;
            } elseif (')' === $expression[$index]) {
                $parenthesis--;
            }
        }

        return $index;
    }
protected function getGroupNodeClosingIndex(array $expression)
    {
        $parenthesis = 1;
        $index = 0;

        while ($parenthesis > 0) {
            $index++;
            if ($index > count($expression)) {
                $this->addError('Parenthesis not correctly closed.', self::ERROR_CODE_CLOSING_PARENTHESIS_NOT_FOUND);
            }

            if ('(' === $expression[$index]) {
                $parenthesis++;
            } elseif (')' === $expression[$index]) {
                $parenthesis--;
            }
        }

        return $index;
    }
protected function getGroupNodeClosingIndex ( array $ expression ) { $ parenthesis = 1 ; $ index = 0 ; while ( $ parenthesis > 0 ) { $ index ++ ; if ( $ index > count ( $ expression ) ) { $ this -> addError ( 'Parenthesis not correctly closed.' , self :: ERROR_CODE_CLOSING_PARENTHESIS_NOT_FOUND ) ; } if ( '(' === $ expression [ $ index ] ) { $ parenthesis ++ ; } elseif ( ')' === $ expression [ $ index ] ) { $ parenthesis -- ; } } return $ index ; }
Returns the index of the closing parenthesis that matches the opening
parenthesis at index 0 of the given expression.

@param array $expression
@return int
Returns the index of the closing parenthesis that matches the opening parenthesis at index 0 of the given expression .