]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - extensions/LocalisationUpdate/fetcher/FetcherFactory.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / extensions / LocalisationUpdate / fetcher / FetcherFactory.php
1 <?php
2 /**
3  * @file
4  * @author Niklas Laxström
5  * @license GPL-2.0+
6  */
7
8 namespace LocalisationUpdate;
9
10 /**
11  * Constructs fetchers based on the repository urls.
12  */
13 class FetcherFactory {
14         public function getFetcher( $path ) {
15                 if ( strpos( $path, 'https://raw.github.com/' ) === 0 ) {
16                         return new GitHubFetcher();
17                 } elseif ( strpos( $path, 'http://' ) === 0 ) {
18                         return new HttpFetcher();
19                 } elseif ( strpos( $path, 'https://' ) === 0 ) {
20                         return new HttpFetcher();
21                 } else {
22                         return new FileSystemFetcher();
23                 }
24         }
25 }