Passed
Push — master ( 272a3b...fe3af1 )
by Josh
04:19
created

TablePosition::getCell()   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
/**
6
 * Class TablePosition.
7
 */
8
class TablePosition
9
{
10
    /**
11
     * @var int
12
     */
13
    public $row;
14
    /**
15
     * @var int
16
     */
17
    public $cell;
18
19
    /**
20
     * TablePosition constructor.
21
     *
22
     * @param int $row
23
     * @param int $cell
24
     */
25 1
    public function __construct($row, $cell)
26
    {
27 1
        $this->row = $row;
28 1
        $this->cell = $cell;
29 1
    }
30
31
    /**
32
     * @return int
33
     */
34
    public function getRow()
35
    {
36
        return $this->row;
37
    }
38
39
    /**
40
     * @return int
41
     */
42
    public function getCell()
43
    {
44
        return $this->cell;
45
    }
46
47
    /**
48
     * @return string
49
     */
50
    public function __toString()
51
    {
52
        return $this->row.':'.$this->cell;
53
    }
54
55
    /**
56
     * @param TablePosition $a
57
     * @param TablePosition $b
58
     *
59
     * @return int
60
     */
61
    public static function compare($a, $b)
62
    {
63
        if ($a->getRow() == $b->getRow()) {
64
            return $a->getCell() - $b->getCell();
65
        }
66
67
        return $a->getRow() - $b->getRow();
68
    }
69
}
70