cf2c23888c210a0c0433644c7b775f6ec3eb1de2
[yaffs-website] / vendor / caxy / php-htmldiff / lib / Caxy / HtmlDiff / Table / TableCell.php
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     public function getRow()
19     {
20         return $this->row;
21     }
22
23     /**
24      * @param TableRow|null $row
25      *
26      * @return $this
27      */
28     public function setRow(TableRow $row = null)
29     {
30         $this->row = $row;
31
32         if (null !== $row && !in_array($this, $row->getCells())) {
33             $row->addCell($this);
34         }
35
36         return $this;
37     }
38
39     /**
40      * @return int
41      */
42     public function getColspan()
43     {
44         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 }