Code Duplication    Length = 27-29 lines in 2 locations

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

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

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

@@ 729-757 (lines=29) @@
726
727
            // データ行の出力.
728
            $app['eccube.service.csv.export']->setExportQueryBuilder($qb);
729
            $app['eccube.service.csv.export']->exportData(function ($entity, $csvService) {
730
731
                $Csvs = $csvService->getCsvs();
732
733
                /** @var $Product \Eccube\Entity\Product */
734
                $Product = $entity;
735
736
                /** @var $Product \Eccube\Entity\ProductClass[] */
737
                $ProductClassess = $Product->getProductClasses();
738
739
                foreach ($ProductClassess as $ProductClass) {
740
                    $row = array();
741
742
                    // CSV出力項目と合致するデータを取得.
743
                    foreach ($Csvs as $Csv) {
744
                        // 商品データを検索.
745
                        $data = $csvService->getData($Csv, $Product);
746
                        if (is_null($data)) {
747
                            // 商品規格情報を検索.
748
                            $data = $csvService->getData($Csv, $ProductClass);
749
                        }
750
                        $row[] = $data;
751
                    }
752
753
                    //$row[] = number_format(memory_get_usage(true));
754
                    // 出力.
755
                    $csvService->fputcsv($row);
756
                }
757
            });
758
        });
759
760
        $now = new \DateTime();