Code Duplication    Length = 27-29 lines in 2 locations

src/Eccube/Controller/Admin/Order/OrderController.php 1 location

@@ 242-268 (lines=27) @@
239
240
            // データ行の出力.
241
            $app['eccube.service.csv.export']->setExportQueryBuilder($qb);
242
            $app['eccube.service.csv.export']->exportData(function ($entity, $csvService) {
243
244
                $Csvs = $csvService->getCsvs();
245
246
                $Order = $entity;
247
                $OrderDetails = $Order->getOrderDetails();
248
249
                foreach ($OrderDetails as $OrderDetail) {
250
                    $row = array();
251
252
                    // CSV出力項目と合致するデータを取得.
253
                    foreach ($Csvs as $Csv) {
254
                        // 受注データを検索.
255
                        $data = $csvService->getData($Csv, $Order);
256
                        if (is_null($data)) {
257
                            // 受注データにない場合は, 受注明細を検索.
258
                            $data = $csvService->getData($Csv, $OrderDetail);
259
                        }
260
                        $row[] = $data;
261
262
                    }
263
264
                    //$row[] = number_format(memory_get_usage(true));
265
                    // 出力.
266
                    $csvService->fputcsv($row);
267
                }
268
            });
269
        });
270
271
        $now = new \DateTime();

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

@@ 677-705 (lines=29) @@
674
675
            // データ行の出力.
676
            $app['eccube.service.csv.export']->setExportQueryBuilder($qb);
677
            $app['eccube.service.csv.export']->exportData(function ($entity, $csvService) {
678
679
                $Csvs = $csvService->getCsvs();
680
681
                /** @var $Product \Eccube\Entity\Product */
682
                $Product = $entity;
683
684
                /** @var $Product \Eccube\Entity\ProductClass[] */
685
                $ProductClassess = $Product->getProductClasses();
686
687
                foreach ($ProductClassess as $ProductClass) {
688
                    $row = array();
689
690
                    // CSV出力項目と合致するデータを取得.
691
                    foreach ($Csvs as $Csv) {
692
                        // 商品データを検索.
693
                        $data = $csvService->getData($Csv, $Product);
694
                        if (is_null($data)) {
695
                            // 商品規格情報を検索.
696
                            $data = $csvService->getData($Csv, $ProductClass);
697
                        }
698
                        $row[] = $data;
699
                    }
700
701
                    //$row[] = number_format(memory_get_usage(true));
702
                    // 出力.
703
                    $csvService->fputcsv($row);
704
                }
705
            });
706
        });
707
708
        $now = new \DateTime();