BaseToken::getOffset()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the fubhy/math-php package.
5
 *
6
 * (c) Sebastian Siemssen <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Fubhy\Math\Token;
13
14
/**
15
 * Abstract base class for tokens.
16
 *
17
 * @author Sebastian Siemssen <[email protected]>
18
 */
19
abstract class BaseToken implements TokenInterface
20
{
21
    /**
22
     * The offset of the token in the expression.
23
     *
24
     * @var int
25
     */
26
    protected $offset;
27
28
    /**
29
     * The value of the token.
30
     *
31
     * @var mixed
32
     */
33
    protected $value;
34
35
    /**
36
     * Returns the offset of the token in the expression.
37
     *
38
     * @return int
39
     *     The offset of the token.
40
     */
41
    public function getOffset()
42
    {
43
        return $this->offset;
44
    }
45
46
    /**
47
     * Returns the value of the token.
48
     *
49
     * @return mixed
50
     *     The value of the token.
51
     */
52
    public function getValue()
53
    {
54
        return $this->value;
55
    }
56
57
    /**
58
     * Constructs a new TokenBase object.
59
     *
60
     * @param int $offset
61
     *     The offset of the token in the string.
62
     * @param mixed $value
63
     *     The value of the token.
64
     */
65
    public function __construct($offset, $value)
66
    {
67
        $this->offset = $offset;
68
        $this->value = $value;
69
    }
70
}
71