Code Duplication    Length = 15-18 lines in 2 locations

src/Mouf/Mvc/Splash/Store/SplashUrlNode.php 2 locations

@@ 70-84 (lines=15) @@
67
                }
68
69
                $httpMethods = $callback->getHttpMethods();
70
                if (empty($httpMethods)) {
71
                    if (isset($this->wildcardCallbacks[''])) {
72
                        throw new SplashException("An error occured while looking at the list URL managed in Splash. The URL '".$callback->getUrl()."' is associated "
73
                                ."to 2 methods: \$".$callback->getControllerInstanceName().'->'.$callback->getMethodName()." and \$".$this->wildcardCallbacks['']->getControllerInstanceName().'->'.$this->wildcardCallbacks['']->getMethodName());
74
                    }
75
                    $this->wildcardCallbacks[''] = $callback;
76
                } else {
77
                    foreach ($httpMethods as $httpMethod) {
78
                        if (isset($this->wildcardCallbacks[$httpMethod])) {
79
                            throw new SplashException("An error occured while looking at the list URL managed in Splash. The URL '".$callback->getUrl()."' for HTTP method '".$httpMethod."' is associated "
80
                                    ."to 2 methods: \$".$callback->getControllerInstanceName().'->'.$callback->getMethodName()." and \$".$this->wildcardCallbacks[$httpMethod]->getControllerInstanceName().'->'.$this->wildcardCallbacks[$httpMethod]->getMethodName());
81
                        }
82
                        $this->wildcardCallbacks[$httpMethod] = $callback;
83
                    }
84
                }
85
            } elseif (strpos($key, '{') === 0 && strpos($key, '}') === strlen($key) - 1) {
86
                // Parameterized URL element
87
                $varName = substr($key, 1, strlen($key) - 2);
@@ 100-117 (lines=18) @@
97
                }
98
                $this->children[$key]->addUrl($urlParts, $callback);
99
            }
100
        } else {
101
            $httpMethods = $callback->getHttpMethods();
102
            if (empty($httpMethods)) {
103
                if (isset($this->callbacks[''])) {
104
                    throw new SplashException("An error occured while looking at the list URL managed in Splash. The URL '".$callback->getUrl()."' is associated "
105
                        ."to 2 methods: \$".$callback->getControllerInstanceName().'->'.$callback->getMethodName()." and \$".$this->callbacks['']->getControllerInstanceName().'->'.$this->callbacks['']->getMethodName());
106
                }
107
                $this->callbacks[''] = $callback;
108
            } else {
109
                foreach ($httpMethods as $httpMethod) {
110
                    if (isset($this->callbacks[$httpMethod])) {
111
                        throw new SplashException("An error occured while looking at the list URL managed in Splash. The URL '".$callback->getUrl()."' for HTTP method '".$httpMethod."' is associated "
112
                            ."to 2 methods: \$".$callback->getControllerInstanceName().'->'.$callback->getMethodName()." and \$".$this->callbacks[$httpMethod]->getControllerInstanceName().'->'.$this->callbacks[$httpMethod]->getMethodName());
113
                    }
114
                    $this->callbacks[$httpMethod] = $callback;
115
                }
116
            }
117
        }
118
    }
119
120
    /**