Code Duplication    Length = 30-32 lines in 2 locations

src/Eccube/Controller/Admin/Customer/CustomerController.php 1 location

@@ 257-288 (lines=32) @@
254
255
            // データ行の出力.
256
            $app['eccube.service.csv.export']->setExportQueryBuilder($qb);
257
            $app['eccube.service.csv.export']->exportData(function ($entity, $csvService) use ($app, $request) {
258
259
                $Csvs = $csvService->getCsvs();
260
261
                /** @var $Customer \Eccube\Entity\Customer */
262
                $Customer = $entity;
263
264
                $ExportCsvRow = new \Eccube\Entity\ExportCsvRow();
265
266
                // CSV出力項目と合致するデータを取得.
267
                foreach ($Csvs as $Csv) {
268
                    // 会員データを検索.
269
                    $ExportCsvRow->setData($csvService->getData($Csv, $Customer));
270
271
                    $event = new EventArgs(
272
                        array(
273
                            'csvService' => $csvService,
274
                            'Csv' => $Csv,
275
                            'Customer' => $Customer,
276
                            'ExportCsvRow' => $ExportCsvRow,
277
                        ),
278
                        $request
279
                    );
280
                    $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_CUSTOMER_CSV_EXPORT, $event);
281
282
                    $ExportCsvRow->pushData();
283
                }
284
285
                //$row[] = number_format(memory_get_usage(true));
286
                // 出力.
287
                $csvService->fputcsv($ExportCsvRow->getRow());
288
            });
289
        });
290
291
        $now = new \DateTime();

src/Eccube/Controller/Admin/Product/CategoryController.php 1 location

@@ 222-251 (lines=30) @@
219
220
            // データ行の出力.
221
            $app['eccube.service.csv.export']->setExportQueryBuilder($qb);
222
            $app['eccube.service.csv.export']->exportData(function ($entity, $csvService) use ($app, $request) {
223
224
                $Csvs = $csvService->getCsvs();
225
226
                /** @var $Category \Eccube\Entity\Category */
227
                $Category = $entity;
228
229
                // CSV出力項目と合致するデータを取得.
230
                $ExportCsvRow = new \Eccube\Entity\ExportCsvRow();
231
                foreach ($Csvs as $Csv) {
232
                    $ExportCsvRow->setData($csvService->getData($Csv, $Category));
233
234
                    $event = new EventArgs(
235
                        array(
236
                            'csvService' => $csvService,
237
                            'Csv' => $Csv,
238
                            'Category' => $Category,
239
                            'ExportCsvRow' => $ExportCsvRow,
240
                        ),
241
                        $request
242
                    );
243
                    $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CATEGORY_CSV_EXPORT, $event);
244
245
                    $ExportCsvRow->pushData();
246
                }
247
248
                //$row[] = number_format(memory_get_usage(true));
249
                // 出力.
250
                $csvService->fputcsv($ExportCsvRow->getRow());
251
            });
252
        });
253
254
        $now = new \DateTime();