Passed
Push — master ( d304b3...db8bd2 )
by Sven
01:20 queued 11s
created

MatchingBlock::count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
3
namespace Caxy\HtmlDiff;
4
5
/**
6
 * A (string) block of text is the same between the two provided versions.
7
 */
8
class MatchingBlock implements \Countable
9
{
10
    public $startInOld;
11
    public $startInNew;
12
    public $size;
13
14 16
    public function __construct(int $startInOld, int $startInNew, int $size)
15
    {
16 16
        $this->startInOld = $startInOld;
17 16
        $this->startInNew = $startInNew;
18 16
        $this->size       = $size;
19 16
    }
20
21 16
    public function endInOld() : int
22
    {
23 16
        return ($this->startInOld + $this->size);
24
    }
25
26 16
    public function endInNew() : int
27
    {
28 16
        return ($this->startInNew + $this->size);
29
    }
30
31 16
    public function count() : int
32
    {
33 16
        return (int)$this->size;
34
    }
35
}
36