Passed
Pull Request — master (#31)
by Josh
03:43
created

TablePosition::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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