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

TableCell::getColspan()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 2
eloc 2
nc 2
nop 0
crap 6
1
<?php
2
3
namespace Caxy\HtmlDiff\Table;
4
5
/**
6
 * Class TableCell
7
 * @package Caxy\HtmlDiff\Table
8
 */
9
class TableCell extends AbstractTableElement
10
{
11
    /**
12
     * @var TableRow
13
     */
14
    protected $row;
15
16
    /**
17
     * @return TableRow
18
     */
19
    public function getRow()
20
    {
21
        return $this->row;
22
    }
23
24
    /**
25
     * @param TableRow|null $row
26
     *
27
     * @return $this
28
     */
29
    public function setRow(TableRow $row = null)
30
    {
31
        $this->row = $row;
32
33
        if (null !== $row && !in_array($this, $row->getCells())) {
34
            $row->addCell($this);
35
        }
36
37
        return $this;
38
    }
39
40
    /**
41
     * @return int
42
     */
43
    public function getColspan()
44
    {
45
        return (int)$this->getAttribute('colspan') ?: 1;
46
    }
47
48
    /**
49
     * @return int
50
     */
51
    public function getRowspan()
52
    {
53
        return (int)$this->getAttribute('rowspan') ?: 1;
54
    }
55
}
56