Code Duplication    Length = 24-28 lines in 4 locations

src/Eccube/Application.php 4 locations

@@ 719-746 (lines=28) @@
716
        }, 30); // Routing(32)が解決しし, 認証判定(8)が実行される前のタイミング.
717
718
        // Controller Event
719
        $this->on(\Symfony\Component\HttpKernel\KernelEvents::CONTROLLER, function (\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event) use ($app) {
720
721
            if (!$event->isMasterRequest()) {
722
                return;
723
            }
724
725
            $route = $event->getRequest()->attributes->get('_route');
726
727
            if (is_null($route)) {
728
                return;
729
            }
730
731
            $app['monolog']->debug('KernelEvents::CONTROLLER '.$route);
732
733
            // 全体
734
            $app['eccube.event.dispatcher']->dispatch('eccube.event.app.controller', $event);
735
736
            if (strpos($route, 'admin') === 0) {
737
                // 管理画面
738
                $app['eccube.event.dispatcher']->dispatch('eccube.event.admin.controller', $event);
739
            } else {
740
                // フロント画面
741
                $app['eccube.event.dispatcher']->dispatch('eccube.event.front.controller', $event);
742
            }
743
744
            // ルーティング単位
745
            $app['eccube.event.dispatcher']->dispatch("eccube.event.route.{$route}.controller", $event);
746
        });
747
748
        // Response Event
749
        $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function (\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) {
@@ 749-775 (lines=27) @@
746
        });
747
748
        // Response Event
749
        $this->on(\Symfony\Component\HttpKernel\KernelEvents::RESPONSE, function (\Symfony\Component\HttpKernel\Event\FilterResponseEvent $event) use ($app) {
750
            if (!$event->isMasterRequest()) {
751
                return;
752
            }
753
754
            $route = $event->getRequest()->attributes->get('_route');
755
756
            if (is_null($route)) {
757
                return;
758
            }
759
760
            $app['monolog']->debug('KernelEvents::RESPONSE '.$route);
761
762
            // ルーティング単位
763
            $app['eccube.event.dispatcher']->dispatch("eccube.event.route.{$route}.response", $event);
764
765
            if (strpos($route, 'admin') === 0) {
766
                // 管理画面
767
                $app['eccube.event.dispatcher']->dispatch('eccube.event.admin.response', $event);
768
            } else {
769
                // フロント画面
770
                $app['eccube.event.dispatcher']->dispatch('eccube.event.front.response', $event);
771
            }
772
773
            // 全体
774
            $app['eccube.event.dispatcher']->dispatch('eccube.event.app.response', $event);
775
        });
776
777
        // Exception Event
778
        $this->on(\Symfony\Component\HttpKernel\KernelEvents::EXCEPTION, function (\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event) use ($app) {
@@ 778-805 (lines=28) @@
775
        });
776
777
        // Exception Event
778
        $this->on(\Symfony\Component\HttpKernel\KernelEvents::EXCEPTION, function (\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event) use ($app) {
779
780
            if (!$event->isMasterRequest()) {
781
                return;
782
            }
783
784
            $route = $event->getRequest()->attributes->get('_route');
785
786
            if (is_null($route)) {
787
                return;
788
            }
789
790
            $app['monolog']->debug('KernelEvents::EXCEPTION '.$route);
791
792
            // ルーティング単位
793
            $app['eccube.event.dispatcher']->dispatch("eccube.event.route.{$route}.exception", $event);
794
795
            if (strpos($route, 'admin') === 0) {
796
                // 管理画面
797
                $app['eccube.event.dispatcher']->dispatch('eccube.event.admin.exception', $event);
798
            } else {
799
                // フロント画面
800
                $app['eccube.event.dispatcher']->dispatch('eccube.event.front.exception', $event);
801
            }
802
803
            // 全体
804
            $app['eccube.event.dispatcher']->dispatch('eccube.event.app.exception', $event);
805
        });
806
807
        // Terminate Event
808
        $this->on(\Symfony\Component\HttpKernel\KernelEvents::TERMINATE, function (\Symfony\Component\HttpKernel\Event\PostResponseEvent $event) use ($app) {
@@ 808-831 (lines=24) @@
805
        });
806
807
        // Terminate Event
808
        $this->on(\Symfony\Component\HttpKernel\KernelEvents::TERMINATE, function (\Symfony\Component\HttpKernel\Event\PostResponseEvent $event) use ($app) {
809
810
            $route = $event->getRequest()->attributes->get('_route');
811
812
            if (is_null($route)) {
813
                return;
814
            }
815
816
            $app['monolog']->debug('KernelEvents::TERMINATE '.$route);
817
818
            // ルーティング単位
819
            $app['eccube.event.dispatcher']->dispatch("eccube.event.route.{$route}.terminate", $event);
820
821
            if (strpos($route, 'admin') === 0) {
822
                // 管理画面
823
                $app['eccube.event.dispatcher']->dispatch('eccube.event.admin.terminate', $event);
824
            } else {
825
                // フロント画面
826
                $app['eccube.event.dispatcher']->dispatch('eccube.event.front.terminate', $event);
827
            }
828
829
            // 全体
830
            $app['eccube.event.dispatcher']->dispatch('eccube.event.app.terminate', $event);
831
        });
832
    }
833
834
    public function loadPlugin()