summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/Translate/ttmserver/FakeTTMServer.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/Translate/ttmserver/FakeTTMServer.php')
-rw-r--r--www/wiki/extensions/Translate/ttmserver/FakeTTMServer.php60
1 files changed, 60 insertions, 0 deletions
diff --git a/www/wiki/extensions/Translate/ttmserver/FakeTTMServer.php b/www/wiki/extensions/Translate/ttmserver/FakeTTMServer.php
new file mode 100644
index 00000000..16715592
--- /dev/null
+++ b/www/wiki/extensions/Translate/ttmserver/FakeTTMServer.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * TTMServer - The Translate extension translation memory interface
+ *
+ * @file
+ * @author Niklas Laxström
+ * @copyright Copyright © 2012-2013, Niklas Laxström
+ * @license GPL-2.0-or-later
+ * @ingroup TTMServer
+ */
+
+/**
+ * NO-OP version of TTMServer when it is disabled.
+ * Keeps other code simpler when they can just do
+ * TTMServer::primary()->update( ... );
+ * @since 2012-01-28
+ * @ingroup TTMServer
+ */
+class FakeTTMServer implements ReadableTTMServer, WritableTTMServer {
+ public function query( $sourceLanguage, $targetLanguage, $text ) {
+ return [];
+ }
+
+ public function isLocalSuggestion( array $suggestion ) {
+ false;
+ }
+
+ public function expandLocation( array $suggestion ) {
+ return '';
+ }
+
+ public function update( MessageHandle $handle, $targetText ) {
+ }
+
+ public function beginBootstrap() {
+ }
+
+ public function beginBatch() {
+ }
+
+ public function batchInsertDefinitions( array $batch ) {
+ }
+
+ public function batchInsertTranslations( array $batch ) {
+ }
+
+ public function endBatch() {
+ }
+
+ public function endBootstrap() {
+ }
+
+ public function getMirrors() {
+ return [];
+ }
+
+ public function isFrozen() {
+ return false;
+ }
+}