summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/LocalisationUpdate/fetcher/FetcherFactory.php
blob: 570dc7e0b4202ed661769488a8251036c8e260e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
/**
 * @file
 * @author Niklas Laxström
 * @license GPL-2.0+
 */

namespace LocalisationUpdate;

/**
 * Constructs fetchers based on the repository urls.
 */
class FetcherFactory {
	public function getFetcher( $path ) {
		if ( strpos( $path, 'https://raw.github.com/' ) === 0 ) {
			return new GitHubFetcher();
		} elseif ( strpos( $path, 'http://' ) === 0 ) {
			return new HttpFetcher();
		} elseif ( strpos( $path, 'https://' ) === 0 ) {
			return new HttpFetcher();
		} else {
			return new FileSystemFetcher();
		}
	}
}