Completed
Branch 0.8-dev (c4d6ef)
by Kacper
02:50
created

Result::append()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
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
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 merge($tokens)
35
    {
36 2
        foreach ($tokens as $token) {
37 2
            $this->append($token);
38 2
        }
39 2
    }
40
41 1
    public function getTokens()
42
    {
43 1
        return $this->getArrayCopy();
44
    }
45
}