Piwik\Plugins\Referrers\API::removeSubtableIds PHP Method

removeSubtableIds() private method

Utility function that removes the subtable IDs for the subtables of the getReferrerType report. This avoids infinite recursion in said report (ie, the grandchildren of the report will be the original report, and it will recurse when trying to get a flat report).
private removeSubtableIds ( DataTable $table ) : DataTable
$table Piwik\DataTable
return Piwik\DataTable Returns $table for convenience.
    private function removeSubtableIds($table)
    {
        if ($table instanceof DataTable\Map) {
            foreach ($table->getDataTables() as $childTable) {
                $this->removeSubtableIds($childTable);
            }
        } else {
            foreach ($table->getRows() as $row) {
                $row->removeSubtable();
            }
        }
        return $table;
    }