Passed
Push — master ( 1564fa...d2ad69 )
by Kacper
03:00 queued 15s
created

TokenIterator   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getSource() 0 4 1
A getTokens() 0 3 1
A sort() 0 3 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
19
class TokenIterator extends \ArrayIterator
20
{
21
    private $_source;
22
23
    /**
24
     * TokenIterator constructor.
25
     *
26
     * @param array  $array
27
     * @param string $source
28
     * @param int    $flags
29
     */
30 3
    public function __construct(array $array, $source, $flags = 0)
31
    {
32 3
        $this->_source = $source;
33
34 3
        parent::__construct($array, $flags);
35 3
    }
36
37 1
    public function getSource()
38
    {
39 1
        return $this->_source;
40
    }
41
42 2
    public function getTokens() {
43 2
        return $this->getArrayCopy();
44
    }
45
46 1
    public function sort() {
47 1
        $this->uasort('\Kadet\Highlighter\Parser\Token::compare');
48
    }
49
}