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

MatchingBlock   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A endInOld() 0 4 1
A endInNew() 0 4 1
A count() 0 4 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