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

TokenIterator   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 8
Bugs 0 Features 0
Metric Value
wmc 4
c 8
b 0
f 0
lcom 0
cbo 0
dl 0
loc 36
ccs 8
cts 8
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getSource() 0 4 1
A getOffset() 0 4 1
A getTokens() 0 4 1
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