Code Duplication    Length = 4-6 lines in 7 locations

src/Wrapper.php 7 locations

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