Lexeme::getPos()   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 0
Metric Value
eloc 1
dl 0
loc 2
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace donatj\Printf;
4
5
/**
6
 * Lexeme represents a "basic" component of a printf string - either Literal Strings "!" or Invalid Lexemes
7
 */
8
class Lexeme {
9
10
	public const T_INVALID        = '';
11
	public const T_LITERAL_STRING = '!';
12
13
	protected string $lexItemType;
14
	protected string $val;
15
	protected int $pos;
16
17
	/**
18
	 * LexItem constructor.
19
	 */
20 15
	public function __construct( string $lexItemType, string $val, int $pos ) {
21 15
		$this->lexItemType = $lexItemType;
22 15
		$this->val         = $val;
23 15
		$this->pos         = $pos;
24
	}
25
26
	/**
27
	 * The type of the printf Lexeme
28
	 */
29 15
	public function getLexItemType() : string {
30 15
		return $this->lexItemType;
31
	}
32
33
	/**
34
	 * The text of the lexeme
35
	 */
36 15
	public function getVal() : string {
37 15
		return $this->val;
38
	}
39
40
	/**
41
	 * The string position of the given lexeme
42
	 */
43 10
	public function getPos() : int {
44 10
		return $this->pos;
45
	}
46
47
}
48