public function nextMatchingBracket()
    {
        if (!$this->valid()) {
            return;
        }

        $matches = ['(' => ')', '{' => '}', '[' => ']'];

        $token = $this->current();
        $content = $open = $token[0];

        if (!isset($matches[$open])) {
            return;
        }
        $level = 1;
        $close = $matches[$open];

        $start = $this->_current;
        $count = $this->count();
        $this->_current++;

        while ($this->_current < $count) {
            $type = $this->_data[$this->_current][0];
            if ($type === $close) {
                $level--;
            } elseif ($type === $open) {
                $level++;
            }
            $content .= $this->_data[$this->_current][1];
            if ($level === 0) {
                return $content;
            }
            $this->_current++;
        }
        $this->_current = $start;
    }