Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php |
||
| 18 | class EccubeListener implements EventSubscriberInterface |
||
| 19 | { |
||
| 20 | |||
| 21 | protected $log; |
||
| 22 | |||
| 23 | 1062 | public function __construct(Log $log) |
|
| 27 | |||
| 28 | /** |
||
| 29 | * @param GetResponseEvent $event |
||
| 30 | */ |
||
| 31 | 462 | public function onKernelRequestEarly(GetResponseEvent $event) |
|
| 39 | |||
| 40 | /** |
||
| 41 | * @param GetResponseEvent $event |
||
| 42 | */ |
||
| 43 | 460 | View Code Duplication | public function onKernelRequest(GetResponseEvent $event) |
| 52 | |||
| 53 | /** |
||
| 54 | * @param FilterControllerEvent $event |
||
| 55 | */ |
||
| 56 | 459 | View Code Duplication | public function onKernelController(FilterControllerEvent $event) |
| 65 | |||
| 66 | /** |
||
| 67 | * @param FilterResponseEvent $event |
||
| 68 | */ |
||
| 69 | 450 | View Code Duplication | public function onKernelResponse(FilterResponseEvent $event) |
| 78 | |||
| 79 | /** |
||
| 80 | * @param PostResponseEvent $event |
||
| 81 | */ |
||
| 82 | 447 | public function onKernelTerminate(PostResponseEvent $event) |
|
| 87 | |||
| 88 | /** |
||
| 89 | * @param GetResponseForExceptionEvent $event |
||
| 90 | */ |
||
| 91 | 17 | public function onKernelException(GetResponseForExceptionEvent $event) |
|
| 108 | |||
| 109 | /** |
||
| 110 | * {@inheritdoc} |
||
| 111 | */ |
||
| 112 | 1062 | public static function getSubscribedEvents() |
|
| 132 | |||
| 133 | /** |
||
| 134 | * ルーティング名を取得する. |
||
| 135 | * |
||
| 136 | * @param $request |
||
| 137 | * @return string |
||
| 138 | */ |
||
| 139 | 463 | private function getRoute($request) |
|
| 143 | } |
||
| 144 |