Completed
Push — master ( 29545d...bdb788 )
by Kacper
04:24
created

TokenIterator::getOffset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Highlighter
4
 *
5
 * Copyright (C) 2016, Some right reserved.
6
 *
7
 * @author Kacper "Kadet" Donat <[email protected]>
8
 *
9
 * Contact with author:
10
 * Xmpp: [email protected]
11
 * E-mail: [email protected]
12
 *
13
 * From Kadet with love.
14
 */
15
16
namespace Kadet\Highlighter\Parser;
17
18
class TokenIterator extends \ArrayIterator implements Tokens
19
{
20
    private $_source;
21
    private $_offset;
22
23
    /**
24
     * TokenIterator constructor.
25
     *
26
     * @param array  $array
27
     * @param string $source
28
     * @param int    $offset
29 16
     * @param int    $flags
30
     */
31 16
    public function __construct(array $array, $source, $offset = 0, $flags = 0)
32
    {
33 16
        $this->_source = $source;
34 16
        $this->_offset = $offset;
35
36 11
        parent::__construct($array, $flags);
37
    }
38 11
39
    public function getSource()
40
    {
41 1
        return $this->_source;
42
    }
43 1
44
    public function getOffset()
45
    {
46
        return $this->_offset;
47
    }
48
49
    public function getTokens()
50
    {
51
        return $this->getArrayCopy();
52
    }
53
}
54