LexemeEmitter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 2
b 0
f 0
dl 0
loc 17
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getLexemes() 0 2 1
A emit() 0 2 1
1
<?php
2
3
namespace donatj\Printf;
4
5
class LexemeEmitter implements Emitter {
6
7
	/** @var Lexeme[] */
8
	private array $lexemes = [];
9
10
	/**
11
	 * @internal This is for use by the Parser
12
	 */
13 5
	public function emit( Lexeme $lexItem ) : void {
14 5
		$this->lexemes[] = $lexItem;
15
	}
16
17
	/**
18
	 * Return the Lexemes received by the emitter as an immutable LexemeCollection
19
	 */
20 5
	public function getLexemes() : LexemeCollection {
21 5
		return new LexemeCollection(...$this->lexemes);
22
	}
23
24
}
25