Code Duplication    Length = 27-28 lines in 2 locations

src/Eccube/Controller/Admin/Store/OwnerStoreController.php 2 locations

@@ 359-386 (lines=28) @@
356
     *
357
     * @return \Symfony\Component\HttpFoundation\JsonResponse
358
     */
359
    public function apiSchemaUpdate(Request $request)
360
    {
361
        $this->isTokenValid();
362
363
        $pluginCode = $request->get('pluginCode');
364
365
        try {
366
            $Plugin = $this->pluginRepository->findByCode($pluginCode);
367
368
            if (!$Plugin) {
369
                throw new NotFoundHttpException();
370
            }
371
372
            $config = $this->pluginService->readConfig($this->pluginService->calcPluginDir($Plugin->getCode()));
373
374
            ob_start();
375
            $this->pluginService->generateProxyAndUpdateSchema($Plugin, $config);
376
            $log = ob_get_clean();
377
            ob_end_flush();
378
379
            return $this->json(['success' => true, 'log' => $log]);
380
        } catch (\Exception $e) {
381
            $log = $e->getMessage();
382
            log_error($e);
383
384
            return $this->json(['success' => false, 'log' => $log], 500);
385
        }
386
    }
387
388
    /**
389
     * オーナーズブラグインインストール、更新処理
@@ 397-423 (lines=27) @@
394
     *
395
     * @return \Symfony\Component\HttpFoundation\JsonResponse
396
     */
397
    public function apiUpdate(Request $request)
398
    {
399
        $this->isTokenValid();
400
401
        $pluginCode = $request->get('pluginCode');
402
403
        $log = null;
404
        try {
405
            $Plugin = $this->pluginRepository->findByCode($pluginCode);
406
            if (!$Plugin) {
407
                throw new NotFoundHttpException();
408
            }
409
410
            $config = $this->pluginService->readConfig($this->pluginService->calcPluginDir($Plugin->getCode()));
411
            ob_start();
412
            $this->pluginService->updatePlugin($Plugin, $config);
413
            $log = ob_get_clean();
414
            ob_end_flush();
415
416
            return $this->json(['success' => true, 'log' => $log]);
417
        } catch (\Exception $e) {
418
            $log = $e->getMessage();
419
            log_error($e);
420
        }
421
422
        return $this->json(['success' => false, 'log' => $log], 500);
423
    }
424
425
    /**
426
     * Do confirm update page