Completed
Push — master ( 975979...72a30b )
by mw
01:55
created

MessageReporterFactory   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 6
c 2
b 0
f 1
lcom 1
cbo 3
dl 0
loc 56
ccs 14
cts 14
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 8 2
A clear() 0 3 1
A newNullMessageReporter() 0 3 1
A newObservableMessageReporter() 0 3 1
A newSpyMessageReporter() 0 3 1
1
<?php
2
3
namespace Onoi\MessageReporter;
4
5
/**
6
 * @license GNU GPL v2+
7
 * @since 1.0
8
 *
9
 * @author mwjames
10
 */
11
class MessageReporterFactory {
12
13
	/**
14
	 * @var MessageReporterFactory
15
	 */
16
	private static $instance = null;
17
18
	/**
19
	 * @since 1.0
20
	 *
21
	 * @return MessageReporterFactory
22
	 */
23 2
	public static function getInstance() {
24
25 2
		if ( self::$instance === null ) {
26 2
			self::$instance = new self();
27 2
		}
28
29 2
		return self::$instance;
30
	}
31
32
	/**
33
	 * @since 1.0
34
	 */
35 1
	public static function clear() {
36 1
		self::$instance = null;
37 1
	}
38
39
	/**
40
	 * @since 1.0
41
	 *
42
	 * @return NullMessageReporter
43
	 */
44 1
	public function newNullMessageReporter() {
45 1
		return new NullMessageReporter();
46
	}
47
48
	/**
49
	 * @since 1.0
50
	 *
51
	 * @return ObservableMessageReporter
52
	 */
53 1
	public function newObservableMessageReporter() {
54 1
		return new ObservableMessageReporter();
55
	}
56
57
	/**
58
	 * @since 1.2
59
	 *
60
	 * @return SpyMessageReporter
61
	 */
62 1
	public function newSpyMessageReporter() {
63 1
		return new SpyMessageReporter();
64
	}
65
66
}
67