Completed
Push — master ( aae2fd...925a43 )
by
unknown
06:06
created

LingoBackend   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 70%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 45
ccs 7
cts 10
cp 0.7
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A getMessageLog() 0 3 1
A useCache() 0 3 1
next() 0 1 ?
1
<?php
2
3
/**
4
 * File holding the Extensions\Lingo\LingoBackend class
5
 *
6
 * This file is part of the MediaWiki extension Lingo.
7
 *
8
 * @copyright 2011 - 2016, Stephan Gambke
9
 * @license   GNU General Public License, version 2 (or any later version)
10
 *
11
 * The Lingo extension is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU General Public License as published by the Free
13
 * Software Foundation; either version 2 of the License, or (at your option) any
14
 * later version.
15
 *
16
 * The Lingo extension is distributed in the hope that it will be useful, but
17
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19
 * details.
20
 *
21
 * You should have received a copy of the GNU General Public License along
22
 * with this program. If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 * @author Stephan Gambke
25
 * @file
26
 * @ingroup Lingo
27
 */
28
29
namespace Extensions\Lingo;
30
31
/**
32
 * The Extensions\Lingo\LingoBackend class.
33
 *
34
 * @ingroup Lingo
35
 */
36
abstract class LingoBackend {
37
38
	protected $mMessageLog;
39
40
	/**
41
	 * Extensions\Lingo\LingoBackend constructor.
42
	 * @param LingoMessageLog|null $messages
43
	 */
44 2
	public function __construct( LingoMessageLog &$messages = null ) {
45
46 2
		if ( !$messages ) {
47 2
			$this->mMessageLog = new LingoMessageLog();
48 2
		} else {
49
			$this->mMessageLog = $messages;
50
		}
51 2
	}
52
53
	/**
54
	 * @return LingoMessageLog
55
	 */
56
	public function getMessageLog() {
57
		return $this->mMessageLog;
58
	}
59
60
	/**
61
	 * This function returns true if the backend is cache-enabled.
62
	 *
63
	 * Actual caching is done by the parser, but to be cache-enabled the backend
64
	 * has to call Extensions\Lingo\LingoParser::purgeCache when necessary.
65
	 *
66
	 * @return boolean
67
	 */
68 2
	public function useCache() {
69 2
		return false;
70
	}
71
72
	/**
73
	 * This function returns the next element. The element is an array of four
74
	 * strings: Term, Definition, Link, Source. If there is no next element the
75
	 * function returns null.
76
	 *
77
	 * @return LingoElement | null
78
	 */
79
	abstract public function next();
80
}
81
82