Code Duplication    Length = 36-36 lines in 2 locations

src/Eccube/Controller/ShoppingController.php 2 locations

@@ 60-95 (lines=36) @@
57
     * @param Request $request
58
     * @return mixed
59
     */
60
    public function index(Application $app, Request $request)
61
    {
62
        // カートチェック
63
        $response = $app->forward($app->path("shopping/checkToCart"));
64
        if ($response->isRedirection() || $response->getContent()) {
65
            return $response;
66
        }
67
68
        // 受注情報を初期化
69
        $response = $app->forward($app->path("shopping/initializeOrder"));
70
        if ($response->isRedirection() || $response->getContent()) {
71
            return $response;
72
        }
73
74
        /** @var Order $Order */
75
        $Order = $app['request_scope']->get('Order');
76
77
        // 単価集計
78
        $flowResult = $this->executePurchaseFlow($app, $Order);
79
80
        // フォームを生成する
81
        $app->forward($app->path("shopping/createForm"));
82
83
        if ($flowResult->hasWarning() || $flowResult->hasError()) {
84
            return $app->redirect($app->url('cart'));
85
        }
86
87
        // 複数配送の場合、エラーメッセージを一度だけ表示
88
        $app->forward($app->path("shopping/handleMultipleErrors"));
89
        $form = $app['request_scope']->get(OrderType::class);
90
91
        return [
92
            'form' => $form->createView(),
93
            'Order' => $Order
94
        ];
95
    }
96
97
    /**
98
     * 購入確認画面から, 他の画面へのリダイレクト.
@@ 146-181 (lines=36) @@
143
     * @Method("POST")
144
     * @Route("/confirm", name="shopping/confirm")
145
     */
146
    public function confirm(Application $app, Request $request)
147
    {
148
        // カートチェック
149
        $response = $app->forward($app->path("shopping/checkToCart"));
150
        if ($response->isRedirection() || $response->getContent()) {
151
            return $response;
152
        }
153
154
        // 受注の存在チェック
155
        $response = $app->forward($app->path("shopping/existsOrder"));
156
        if ($response->isRedirection() || $response->getContent()) {
157
            return $response;
158
        }
159
160
        // form作成
161
        // FIXME イベントハンドラを外から渡したい
162
        $app->forward($app->path("shopping/createForm"));
163
164
        $form = $app['request_scope']->get(OrderType::class);
165
        $Order = $app['request_scope']->get('Order');
166
167
        $form->handleRequest($request);
168
169
        // 受注処理
170
        $response = $app->forward($app->path("shopping/completeOrder"));
171
        if ($response->isRedirection() || $response->getContent()) {
172
            return $response;
173
        }
174
175
        log_info('購入チェックエラー', array($Order->getId()));
176
177
        return $app->render('Shopping/index.twig', array(
178
            'form' => $form->createView(),
179
            'Order' => $Order,
180
        ));
181
    }
182
183
184
    /**