Code Duplication    Length = 27-29 lines in 2 locations

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

@@ 264-290 (lines=27) @@
261
262
            // データ行の出力.
263
            $app['eccube.service.csv.export']->setExportQueryBuilder($qb);
264
            $app['eccube.service.csv.export']->exportData(function ($entity, $csvService) {
265
266
                $Csvs = $csvService->getCsvs();
267
268
                $Order = $entity;
269
                $OrderDetails = $Order->getOrderDetails();
270
271
                foreach ($OrderDetails as $OrderDetail) {
272
                    $row = array();
273
274
                    // CSV出力項目と合致するデータを取得.
275
                    foreach ($Csvs as $Csv) {
276
                        // 受注データを検索.
277
                        $data = $csvService->getData($Csv, $Order);
278
                        if (is_null($data)) {
279
                            // 受注データにない場合は, 受注明細を検索.
280
                            $data = $csvService->getData($Csv, $OrderDetail);
281
                        }
282
                        $row[] = $data;
283
284
                    }
285
286
                    //$row[] = number_format(memory_get_usage(true));
287
                    // 出力.
288
                    $csvService->fputcsv($row);
289
                }
290
            });
291
        });
292
293
        $now = new \DateTime();

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

@@ 751-779 (lines=29) @@
748
749
            // データ行の出力.
750
            $app['eccube.service.csv.export']->setExportQueryBuilder($qb);
751
            $app['eccube.service.csv.export']->exportData(function ($entity, $csvService) {
752
753
                $Csvs = $csvService->getCsvs();
754
755
                /** @var $Product \Eccube\Entity\Product */
756
                $Product = $entity;
757
758
                /** @var $Product \Eccube\Entity\ProductClass[] */
759
                $ProductClassess = $Product->getProductClasses();
760
761
                foreach ($ProductClassess as $ProductClass) {
762
                    $row = array();
763
764
                    // CSV出力項目と合致するデータを取得.
765
                    foreach ($Csvs as $Csv) {
766
                        // 商品データを検索.
767
                        $data = $csvService->getData($Csv, $Product);
768
                        if (is_null($data)) {
769
                            // 商品規格情報を検索.
770
                            $data = $csvService->getData($Csv, $ProductClass);
771
                        }
772
                        $row[] = $data;
773
                    }
774
775
                    //$row[] = number_format(memory_get_usage(true));
776
                    // 出力.
777
                    $csvService->fputcsv($row);
778
                }
779
            });
780
        });
781
782
        $now = new \DateTime();