Completed
Push — master ( 910bf7...975979 )
by mw
02:04
created

SpyMessageReporter::clearMessages()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 3
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Onoi\MessageReporter;
4
5
/**
6
 * @license GNU GPL v2+
7
 * @since 1.2
8
 *
9
 * @author mwjames
10
 */
11
class SpyMessageReporter implements MessageReporter {
12
13
	/**
14
	 * @var array
15
	 */
16
	private $messages = array();
17
18
	/**
19
	 * @since 1.2
20
	 *
21
	 * {@inheritDoc}
22
	 */
23 2
	public function reportMessage( $message ) {
24 2
		$this->messages[] = $message;
25 2
	}
26
27
	/**
28
	 * @since 1.2
29
	 *
30
	 * @return array
31
	 */
32 2
	public function getMessages() {
33 2
		return $this->messages;
34
	}
35
36
	/**
37
	 * @since 1.2
38
	 *
39
	 * @return string
40
	 */
41 1
	public function getMessagesAsString() {
42 1
		return implode( ', ', $this->messages );
43
	}
44
45
	/**
46
	 * @since 1.2
47
	 */
48 1
	public function clearMessages() {
49 1
		$this->messages =  array();
50 1
	}
51
52
}
53