Passed
Push — master ( d7540c...231250 )
by Josh
05:57
created

TableCell   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 72.72%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 47
ccs 8
cts 11
cp 0.7272
rs 10
c 2
b 0
f 0
wmc 8
lcom 1
cbo 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getRow() 0 4 1
A getColspan() 0 4 2
A getRowspan() 0 4 2
A setRow() 0 10 3
1
<?php
2
3
namespace Caxy\HtmlDiff\Table;
4
5
/**
6
 * Class TableCell.
7
 */
8
class TableCell extends AbstractTableElement
9
{
10
    /**
11
     * @var TableRow
12
     */
13
    protected $row;
14
15
    /**
16
     * @return TableRow
17
     */
18 1
    public function getRow()
19
    {
20 1
        return $this->row;
21
    }
22
23
    /**
24
     * @param TableRow|null $row
25
     *
26
     * @return $this
27
     */
28 1
    public function setRow(TableRow $row = null)
29
    {
30 1
        $this->row = $row;
31
32 1
        if (null !== $row && !in_array($this, $row->getCells())) {
33
            $row->addCell($this);
34
        }
35
36 1
        return $this;
37
    }
38
39
    /**
40
     * @return int
41
     */
42 1
    public function getColspan()
43
    {
44 1
        return (int) $this->getAttribute('colspan') ?: 1;
45
    }
46
47
    /**
48
     * @return int
49
     */
50
    public function getRowspan()
51
    {
52
        return (int) $this->getAttribute('rowspan') ?: 1;
53
    }
54
}
55