Conditions | 17 |
Paths | 268 |
Total Lines | 111 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
54 | function load_autoload($name){ |
||
55 | static $classes = null; |
||
56 | if($classes === null) $classes = array( |
||
57 | 'Diff' => DOKU_INC.'inc/DifferenceEngine.php', |
||
58 | 'UnifiedDiffFormatter' => DOKU_INC.'inc/DifferenceEngine.php', |
||
59 | 'TableDiffFormatter' => DOKU_INC.'inc/DifferenceEngine.php', |
||
60 | 'cache' => DOKU_INC.'inc/cache.php', |
||
61 | 'cache_parser' => DOKU_INC.'inc/cache.php', |
||
62 | 'cache_instructions' => DOKU_INC.'inc/cache.php', |
||
63 | 'cache_renderer' => DOKU_INC.'inc/cache.php', |
||
64 | 'Input' => DOKU_INC.'inc/Input.class.php', |
||
65 | 'JpegMeta' => DOKU_INC.'inc/JpegMeta.php', |
||
66 | 'SimplePie' => DOKU_INC.'inc/SimplePie.php', |
||
67 | 'FeedParser' => DOKU_INC.'inc/FeedParser.php', |
||
68 | 'IXR_Server' => DOKU_INC.'inc/IXR_Library.php', |
||
69 | 'IXR_Client' => DOKU_INC.'inc/IXR_Library.php', |
||
70 | 'IXR_Error' => DOKU_INC.'inc/IXR_Library.php', |
||
71 | 'IXR_IntrospectionServer' => DOKU_INC.'inc/IXR_Library.php', |
||
72 | 'SafeFN' => DOKU_INC.'inc/SafeFN.class.php', |
||
73 | 'Sitemapper' => DOKU_INC.'inc/Sitemapper.php', |
||
74 | 'Mailer' => DOKU_INC.'inc/Mailer.class.php', |
||
75 | |||
76 | 'Doku_Handler' => DOKU_INC.'inc/parser/handler.php', |
||
77 | 'Doku_Renderer' => DOKU_INC.'inc/parser/renderer.php', |
||
78 | 'Doku_Renderer_xhtml' => DOKU_INC.'inc/parser/xhtml.php', |
||
79 | 'Doku_Renderer_code' => DOKU_INC.'inc/parser/code.php', |
||
80 | 'Doku_Renderer_xhtmlsummary' => DOKU_INC.'inc/parser/xhtmlsummary.php', |
||
81 | 'Doku_Renderer_metadata' => DOKU_INC.'inc/parser/metadata.php', |
||
82 | |||
83 | 'DokuCLI' => DOKU_INC.'inc/cli.php', |
||
84 | 'DokuCLI_Options' => DOKU_INC.'inc/cli.php', |
||
85 | 'DokuCLI_Colors' => DOKU_INC.'inc/cli.php', |
||
86 | |||
87 | ); |
||
88 | |||
89 | if(isset($classes[$name])){ |
||
90 | require ($classes[$name]); |
||
91 | return true; |
||
92 | } |
||
93 | |||
94 | // namespace to directory conversion |
||
95 | $name = str_replace('\\', '/', $name); |
||
96 | |||
97 | // test namespace |
||
98 | if(substr($name, 0, 14) === 'dokuwiki/test/') { |
||
99 | $file = DOKU_INC . '_test/' . substr($name, 14) . '.php'; |
||
100 | if(file_exists($file)) { |
||
101 | require $file; |
||
102 | return true; |
||
103 | } |
||
104 | } |
||
105 | |||
106 | // plugin namespace |
||
107 | if(substr($name, 0, 16) === 'dokuwiki/plugin/') { |
||
108 | $name = str_replace('/test/', '/_test/', $name); // no underscore in test namespace |
||
109 | $file = DOKU_PLUGIN . substr($name, 16) . '.php'; |
||
110 | if(file_exists($file)) { |
||
111 | try { |
||
112 | require $file; |
||
113 | } catch (\Throwable $e) { |
||
|
|||
114 | \dokuwiki\ErrorHandler::showExceptionMsg($e, "Error loading plugin $name"); |
||
115 | } |
||
116 | return true; |
||
117 | } |
||
118 | } |
||
119 | |||
120 | // template namespace |
||
121 | if(substr($name, 0, 18) === 'dokuwiki/template/') { |
||
122 | $name = str_replace('/test/', '/_test/', $name); // no underscore in test namespace |
||
123 | $file = DOKU_INC.'lib/tpl/' . substr($name, 18) . '.php'; |
||
124 | if(file_exists($file)) { |
||
125 | try { |
||
126 | require $file; |
||
127 | } catch (\Throwable $e) { |
||
128 | \dokuwiki\ErrorHandler::showExceptionMsg($e, "Error loading template $name"); |
||
129 | } |
||
130 | return true; |
||
131 | } |
||
132 | } |
||
133 | |||
134 | // our own namespace |
||
135 | if(substr($name, 0, 9) === 'dokuwiki/') { |
||
136 | $file = DOKU_INC . 'inc/' . substr($name, 9) . '.php'; |
||
137 | if(file_exists($file)) { |
||
138 | require $file; |
||
139 | return true; |
||
140 | } |
||
141 | } |
||
142 | |||
143 | // Plugin loading |
||
144 | if(preg_match( |
||
145 | '/^(' . implode('|', PluginController::PLUGIN_TYPES) . ')_plugin_(' . |
||
146 | DOKU_PLUGIN_NAME_REGEX . |
||
147 | ')(?:_([^_]+))?$/', |
||
148 | $name, |
||
149 | $m |
||
150 | )) { |
||
151 | // try to load the wanted plugin file |
||
152 | $c = ((count($m) === 4) ? "/{$m[3]}" : ''); |
||
153 | $plg = DOKU_PLUGIN . "{$m[2]}/{$m[1]}$c.php"; |
||
154 | if(file_exists($plg)){ |
||
155 | try { |
||
156 | require $plg; |
||
157 | } catch (\Throwable $e) { |
||
158 | \dokuwiki\ErrorHandler::showExceptionMsg($e, "Error loading plugin ${$m[2]}"); |
||
159 | } |
||
160 | } |
||
161 | return true; |
||
162 | } |
||
163 | return false; |
||
164 | } |
||
165 | |||
166 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.