Code Duplication    Length = 14-15 lines in 2 locations

view/ThemeResourceLoader.php 2 locations

@@ 194-208 (lines=15) @@
191
	 * @param array $themes List of themes
192
	 * @return string Path to resolved CSS file (relative to base dir)
193
	 */
194
	public function findThemedCSS($name, $themes)
195
	{
196
		$css = "/css/$name.css";
197
		$paths = $this->getThemePaths($themes);
198
		foreach ($paths as $themePath) {
199
			$abspath = $this->base . '/' . $themePath;
200
201
			if (file_exists($abspath . $css)) {
202
				return $themePath . $css;
203
			}
204
		}
205
206
		// CSS exists in no context
207
		return null;
208
	}
209
210
	/**
211
	 * Registers the given themeable javascript as required.
@@ 221-234 (lines=14) @@
218
	 * @param array $themes List of themes
219
	 * @return string Path to resolved javascript file (relative to base dir)
220
	 */
221
	public function findThemedJavascript($name, $themes) {
222
        $js = "/javascript/$name.js";
223
		$paths = $this->getThemePaths($themes);
224
		foreach ($paths as $themePath) {
225
			$abspath = $this->base . '/' . $themePath;
226
227
			if (file_exists($abspath . $js)) {
228
				return $themePath . $js;
229
			}
230
		}
231
232
		// js exists in no context
233
		return null;
234
	}
235
236
	/**
237
	 * Resolve all themes to the list of root folders relative to site root