Code Duplication    Length = 4-6 lines in 7 locations

src/Wrapper.php 7 locations

@@ 186-189 (lines=4) @@
183
            $exists = function_exists($callable);
184
        }
185
186
        if (!$exists) {
187
            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName);
188
            return false;
189
        }
190
191
        $funcDesc = $this->introspectFunction($callable, $plainFuncName);
192
        if (!$funcDesc) {
@@ 230-233 (lines=4) @@
227
        // start to introspect PHP code
228
        if (is_array($callable)) {
229
            $func = new \ReflectionMethod($callable[0], $callable[1]);
230
            if ($func->isPrivate()) {
231
                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName);
232
                return false;
233
            }
234
            if ($func->isProtected()) {
235
                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
236
                return false;
@@ 234-237 (lines=4) @@
231
                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName);
232
                return false;
233
            }
234
            if ($func->isProtected()) {
235
                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
236
                return false;
237
            }
238
            if ($func->isConstructor()) {
239
                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
240
                return false;
@@ 238-241 (lines=4) @@
235
                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
236
                return false;
237
            }
238
            if ($func->isConstructor()) {
239
                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
240
                return false;
241
            }
242
            if ($func->isDestructor()) {
243
                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
244
                return false;
@@ 242-245 (lines=4) @@
239
                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
240
                return false;
241
            }
242
            if ($func->isDestructor()) {
243
                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
244
                return false;
245
            }
246
            if ($func->isAbstract()) {
247
                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName);
248
                return false;
@@ 246-249 (lines=4) @@
243
                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
244
                return false;
245
            }
246
            if ($func->isAbstract()) {
247
                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName);
248
                return false;
249
            }
250
            /// @todo add more checks for static vs. nonstatic?
251
        } else {
252
            $func = new \ReflectionFunction($callable);
@@ 254-259 (lines=6) @@
251
        } else {
252
            $func = new \ReflectionFunction($callable);
253
        }
254
        if ($func->isInternal()) {
255
            // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs
256
            // instead of getparameters to fully reflect internal php functions ?
257
            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName);
258
            return false;
259
        }
260
261
        // retrieve parameter names, types and description from javadoc comments
262