LexemeEmitter::getLexemes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 2
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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