Code Duplication    Length = 29-31 lines in 2 locations

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

@@ 300-330 (lines=31) @@
297
298
            // データ行の出力.
299
            $this->csvExportService->setExportQueryBuilder($qb);
300
            $this->csvExportService->exportData(function ($entity, $csvService) use ($request) {
301
                $Csvs = $csvService->getCsvs();
302
303
                /** @var $Customer \Eccube\Entity\Customer */
304
                $Customer = $entity;
305
306
                $ExportCsvRow = new \Eccube\Entity\ExportCsvRow();
307
308
                // CSV出力項目と合致するデータを取得.
309
                foreach ($Csvs as $Csv) {
310
                    // 会員データを検索.
311
                    $ExportCsvRow->setData($csvService->getData($Csv, $Customer));
312
313
                    $event = new EventArgs(
314
                        [
315
                            'csvService' => $csvService,
316
                            'Csv' => $Csv,
317
                            'Customer' => $Customer,
318
                            'ExportCsvRow' => $ExportCsvRow,
319
                        ],
320
                        $request
321
                    );
322
                    $this->eventDispatcher->dispatch(EccubeEvents::ADMIN_CUSTOMER_CSV_EXPORT, $event);
323
324
                    $ExportCsvRow->pushData();
325
                }
326
327
                //$row[] = number_format(memory_get_usage(true));
328
                // 出力.
329
                $csvService->fputcsv($ExportCsvRow->getRow());
330
            });
331
        });
332
333
        $now = new \DateTime();

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

@@ 316-344 (lines=29) @@
313
314
            // データ行の出力.
315
            $this->csvExportService->setExportQueryBuilder($qb);
316
            $this->csvExportService->exportData(function ($entity, $csvService) use ($request) {
317
                $Csvs = $csvService->getCsvs();
318
319
                /** @var $Category \Eccube\Entity\Category */
320
                $Category = $entity;
321
322
                // CSV出力項目と合致するデータを取得.
323
                $ExportCsvRow = new \Eccube\Entity\ExportCsvRow();
324
                foreach ($Csvs as $Csv) {
325
                    $ExportCsvRow->setData($csvService->getData($Csv, $Category));
326
327
                    $event = new EventArgs(
328
                        [
329
                            'csvService' => $csvService,
330
                            'Csv' => $Csv,
331
                            'Category' => $Category,
332
                            'ExportCsvRow' => $ExportCsvRow,
333
                        ],
334
                        $request
335
                    );
336
                    $this->eventDispatcher->dispatch(EccubeEvents::ADMIN_PRODUCT_CATEGORY_CSV_EXPORT, $event);
337
338
                    $ExportCsvRow->pushData();
339
                }
340
341
                //$row[] = number_format(memory_get_usage(true));
342
                // 出力.
343
                $csvService->fputcsv($ExportCsvRow->getRow());
344
            });
345
        });
346
347
        $now = new \DateTime();