Code Duplication    Length = 30-32 lines in 2 locations

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

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

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

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