Passed
Push — master ( 6c305a...f9f5fe )
by Kacper
02:57
created

Result   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 6
c 2
b 0
f 0
lcom 0
cbo 0
dl 0
loc 29
ccs 16
cts 16
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getSource() 0 4 1
A append() 0 6 2
A merge() 0 6 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
19
class Result extends \ArrayObject implements Tokens
20
{
21
    private $_source;
22
23 13
    public function __construct($source, $input = [])
24
    {
25 13
        $this->_source = $source;
26 13
        parent::__construct($input, 0, \ArrayIterator::class);
27 13
    }
28
29 6
    public function getSource()
30
    {
31 6
        return $this->_source;
32
    }
33
34 2
    public function append($value)
35
    {
36 2
        if(!$value instanceof MetaToken) {
37 2
            parent::append($value);
38 2
        }
39 2
    }
40
41 2
    public function merge($tokens)
42
    {
43 2
        foreach ($tokens as $token) {
44 2
            $this->append($token);
45 2
        }
46
    }
47
}