Cancelled
Push — master ( 5c013f...948458 )
by Josh
322:57 queued 322:57
created

TablePosition   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 6
c 3
b 0
f 1
lcom 1
cbo 0
dl 0
loc 62
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
/**
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