Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
25.00% covered (danger)
25.00%
3 / 12
25.00% covered (danger)
25.00%
3 / 12
CRAP
0.00% covered (danger)
0.00%
0 / 1
FakeTtmServer
25.00% covered (danger)
25.00%
3 / 12
25.00% covered (danger)
25.00%
3 / 12
72.75
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 query
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isLocalSuggestion
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 expandLocation
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 update
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 beginBootstrap
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 beginBatch
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 batchInsertDefinitions
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 batchInsertTranslations
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 endBatch
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 endBootstrap
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setDoReIndex
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2declare( strict_types = 1 );
3
4namespace MediaWiki\Extension\Translate\TtmServer;
5
6use MediaWiki\Extension\Translate\MessageLoading\MessageHandle;
7
8/**
9 * NO-OP version of TtmServer when it is disabled.
10 * Keeps other code simpler when they can just do
11 * TTMServer::primary()->update( ... );
12 *
13 * @author Niklas Laxström
14 * @copyright Copyright © 2012-2013, Niklas Laxström
15 * @license GPL-2.0-or-later
16 * @ingroup TTMServer
17 */
18class FakeTtmServer extends TtmServer implements ReadableTtmServer, WritableTtmServer {
19    public function __construct() {
20        parent::__construct( [] );
21    }
22
23    public function query( string $sourceLanguage, string $targetLanguage, string $text ): array {
24        return [];
25    }
26
27    public function isLocalSuggestion( array $suggestion ): bool {
28        return false;
29    }
30
31    public function expandLocation( array $suggestion ): string {
32        return '';
33    }
34
35    public function update( MessageHandle $handle, ?string $targetText ): bool {
36        return true;
37    }
38
39    public function beginBootstrap(): void {
40    }
41
42    public function beginBatch(): void {
43    }
44
45    public function batchInsertDefinitions( array $batch ): void {
46    }
47
48    public function batchInsertTranslations( array $batch ): void {
49    }
50
51    public function endBatch(): void {
52    }
53
54    public function endBootstrap(): void {
55    }
56
57    public function setDoReIndex(): void {
58    }
59}