Completed
Branch 0.8-dev (af4386)
by Kacper
03:08
created

Result   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 7
c 3
b 0
f 0
lcom 0
cbo 0
dl 0
loc 34
ccs 18
cts 18
cp 1
rs 10

5 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
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
19
use Kadet\Highlighter\Parser\Token\MetaToken;
20
21
class Result extends \ArrayObject implements Tokens
22
{
23
    private $_source;
24
25 13
    public function __construct($source, $input = [])
26
    {
27 13
        $this->_source = $source;
28 13
        parent::__construct($input, 0, \ArrayIterator::class);
29 13
    }
30
31 6
    public function getSource()
32
    {
33 6
        return $this->_source;
34
    }
35
36 11
    public function append($value)
37
    {
38 11
        if(!$value instanceof MetaToken) {
39 11
            parent::append($value);
40 11
        }
41 11
    }
42
43 2
    public function merge($tokens)
44
    {
45 2
        foreach ($tokens as $token) {
46 2
            $this->append($token);
47 2
        }
48 2
    }
49
50 1
    public function getTokens()
51
    {
52 1
        return $this->getArrayCopy();
53
    }
54
}