private function clearSummary($flags)
    {
        $return = null;
        $clearErrors = $flags & Debug::CLEAR_SUMMARY_ERRORS;
        if ($flags & Debug::CLEAR_SUMMARY) {
            $return = 'summary ('.($clearErrors ? 'incl errors' : 'sans errors').')';
            $curPriority = \end($this->data['groupPriorityStack']);  // false if empty
            foreach (\array_keys($this->data['logSummary']) as $priority) {
                $entriesKeep = array();
                if ($priority === $curPriority) {
                    $curDepth = 0;
                    foreach ($this->data['groupStacks'][$priority] as $group) {
                        $curDepth += (int) $group['collect'];
                    }
                    $entriesKeep = $this->debug->internal->getCurrentGroups(
                        $this->data['logSummary'][$priority],
                        $curDepth
                    );
                } else {
                    $this->data['groupStacks'][$priority] = array();
                }
                $this->clearLogHelper($this->data['logSummary'][$priority], $clearErrors, $entriesKeep);
            }
        } elseif ($clearErrors) {
            $return = 'summary errors';
        }
        return $return;
    }