-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathToken.php
More file actions
63 lines (53 loc) · 1.26 KB
/
Token.php
File metadata and controls
63 lines (53 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
declare(strict_types=1);
namespace PHPCR\Util\CND\Scanner;
/**
* Base Token class.
*
* Unless you want to redefine the token type constants, you should rather use GenericToken.
*
* @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
* @license http://opensource.org/licenses/MIT MIT License
* @author Daniel Barsotti <daniel.barsotti@liip.ch>
*/
class Token implements \Stringable
{
public function __construct(
private int $type = 0,
/**
* The token raw data.
*/
private string $data = '',
private int $line = 0,
private int $row = 0,
) {
}
public function getData(): string
{
return $this->data;
}
public function getType(): int
{
return $this->type;
}
public function __toString()
{
return sprintf("TOKEN(%s, '%s', %s, %s)", $this->type, trim($this->data), $this->line, $this->row);
}
public function setLine(int $line): void
{
$this->line = $line;
}
public function getLine(): int
{
return $this->line;
}
public function setRow(int $row): void
{
$this->row = $row;
}
public function getRow(): int
{
return $this->row;
}
}