Passed
Pull Request — master (#31)
by Josh
04:13
created

TablePosition   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getRow() 0 4 1
A getCell() 0 4 1
A __toString() 0 4 1
A compare() 0 8 2
1
<?php
2
3
namespace Caxy\HtmlDiff\Table;
4
5
class TablePosition extends AbstractTableElement
6
{
7
    public $row;
8
    public $cell;
9
10
    public function __construct($row, $cell)
11
    {
12
        $this->row = $row;
13
        $this->cell = $cell;
14
    }
15
16
    public function getRow()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
17
    {
18
        return $this->row;
19
    }
20
21
    public function getCell()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
22
    {
23
        return $this->cell;
24
    }
25
26
    public function __toString()
27
    {
28
        return $this->row.':'.$this->cell;
29
    }
30
31
    public static function compare($a, $b)
32
    {
33
        if ($a->getRow() == $b->getRow()) {
34
            return $a->getCell() - $b->getCell();
35
        }
36
37
        return $a->getRow() - $b->getRow();
38
    }
39
}
40