summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/LocalisationUpdate/fetcher/FetcherFactory.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/LocalisationUpdate/fetcher/FetcherFactory.php')
-rw-r--r--www/wiki/extensions/LocalisationUpdate/fetcher/FetcherFactory.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/www/wiki/extensions/LocalisationUpdate/fetcher/FetcherFactory.php b/www/wiki/extensions/LocalisationUpdate/fetcher/FetcherFactory.php
new file mode 100644
index 00000000..570dc7e0
--- /dev/null
+++ b/www/wiki/extensions/LocalisationUpdate/fetcher/FetcherFactory.php
@@ -0,0 +1,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();
+ }
+ }
+}