Passed
Push — master ( 948458...49e3d0 )
by Josh
01:11
created

TablePosition::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

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