Code Duplication    Length = 25-25 lines in 2 locations

lib/Dwoo/Compiler.php 2 locations

@@ 2061-2085 (lines=25) @@
2058
            }
2059
        } elseif ($pluginType & Core::CLASS_PLUGIN) {
2060
            if ($pluginType & Core::COMPILABLE_PLUGIN) {
2061
                if ($pluginType & Core::CUSTOM_PLUGIN) {
2062
                    $callback = $this->customPlugins[$func]['callback'];
2063
                    if (!is_array($callback)) {
2064
                        if (!method_exists($callback, 'compile')) {
2065
                            throw new Exception('Custom plugin ' . $func . ' must implement the "compile" method to be compilable, or you should provide a full callback to the method to use');
2066
                        }
2067
                        if (($ref = new ReflectionMethod($callback, 'compile')) && $ref->isStatic()) {
2068
                            $funcCompiler = array($callback, 'compile');
2069
                        } else {
2070
                            $funcCompiler = array(new $callback(), 'compile');
2071
                        }
2072
                    } else {
2073
                        $funcCompiler = $callback;
2074
                    }
2075
                } else {
2076
                    if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
2077
                        $funcCompiler = array('Plugin' . Core::toCamelCase($func), 'compile');
2078
                    } else {
2079
                        $funcCompiler = array(
2080
                            Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
2081
                            'compile'
2082
                        );
2083
                    }
2084
                    array_unshift($params, $this);
2085
                }
2086
                $output = call_user_func_array($funcCompiler, $params);
2087
            } else {
2088
                $params = self::implode_r($params);
@@ 3236-3260 (lines=25) @@
3233
                        if ($mapped) {
3234
                            throw new CompilationException($this, 'The @ operator can not be used on compiled plugins.');
3235
                        }
3236
                        if ($pluginType & Core::CUSTOM_PLUGIN) {
3237
                            $callback = $this->customPlugins[$func]['callback'];
3238
                            if (!is_array($callback)) {
3239
                                if (!method_exists($callback, 'compile')) {
3240
                                    throw new Exception('Custom plugin ' . $func . ' must implement the "compile" method to be compilable, or you should provide a full callback to the method to use');
3241
                                }
3242
                                if (($ref = new ReflectionMethod($callback, 'compile')) && $ref->isStatic()) {
3243
                                    $funcCompiler = array($callback, 'compile');
3244
                                } else {
3245
                                    $funcCompiler = array(new $callback(), 'compile');
3246
                                }
3247
                            } else {
3248
                                $funcCompiler = $callback;
3249
                            }
3250
                        } else {
3251
                            if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) {
3252
                                $funcCompiler = array('Plugin' . Core::toCamelCase($func), 'compile');
3253
                            } else {
3254
                                $funcCompiler = array(
3255
                                    Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func),
3256
                                    'compile'
3257
                                );
3258
                            }
3259
                            array_unshift($params, $this);
3260
                        }
3261
                        $output = call_user_func_array($funcCompiler, $params);
3262
                    } else {
3263
                        $params = self::implode_r($params);