Code Duplication    Length = 27-29 lines in 2 locations

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

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

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

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