Code Duplication    Length = 17-17 lines in 2 locations

src/Config/ModelFactory.php 1 location

@@ 117-133 (lines=17) @@
114
        $this->getRepository()->restore($id);
115
    }
116
117
    protected function parseRows(Collection $rows)
118
    {
119
        if ($rows) {
120
            return $rows->map(function ($row) {
121
                $newRow = $this->configManager->getColumns()->mapWithKeys(function ($column) use ($row) {
122
                    return [$column->getName() => $column->setModel($row)->render()];
123
                });
124
125
                // whether this row has been soft deleted
126
                if ($this->getRepository()->isRestorable()) {
127
                    $newRow->put('_deleted', $row->trashed() ? 1 : 0);
128
                }
129
                return $newRow;
130
            });
131
        }
132
        return collect();
133
    }
134
135
    protected function usePagination()
136
    {

src/View/Table.php 1 location

@@ 107-123 (lines=17) @@
104
        return $data;
105
    }
106
107
    protected function parseRows(Collection $rows)
108
    {
109
        if ($rows) {
110
            return $rows->map(function ($row) {
111
                    $newRow = $this->getColumns()->mapWithKeys(function (ColumnInterface $column) use ($row) {
112
                        return [$column->getName() => $column->setModel($row)->getModelValue()];
113
                    });
114
115
                // whether this row has been soft deleted
116
                if ($this->getRepository()->isRestorable()) {
117
                    $newRow->put('_deleted', $row->trashed() ? 1 : 0);
118
                }
119
                return $newRow;
120
            });
121
        }
122
        return collect();
123
    }
124
}
125