1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ajax\semantic\html\content\table; |
4
|
|
|
|
5
|
|
|
use Ajax\semantic\html\base\HtmlSemCollection; |
6
|
|
|
|
7
|
|
|
class HtmlTR extends HtmlSemCollection{ |
8
|
|
|
|
9
|
|
|
private $_tdTagName; |
10
|
|
|
private $_container; |
11
|
|
|
private $_row; |
12
|
|
|
|
13
|
|
|
public function __construct( $identifier, $colCount){ |
14
|
|
|
parent::__construct( $identifier, "tr", ""); |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
public function setColCount($colCount){ |
18
|
|
|
$count=$this->count(); |
19
|
|
|
for($i=$count;$i<$colCount;$i++){ |
20
|
|
|
$item=$this->addItem(NULL); |
21
|
|
|
$item->setTagName($this->_tdTagName); |
22
|
|
|
} |
23
|
|
|
return $this; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
|
27
|
|
|
protected function createItem($value){ |
28
|
|
|
$count=$this->count(); |
29
|
|
|
$td=new HtmlTD("",$this->_container,$value,$this->_tdTagName); |
|
|
|
|
30
|
|
|
$td->setContainer($this->_container, $this->_row, $count); |
31
|
|
|
return $td; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function setTdTagName($tagName="td"){ |
35
|
|
|
$this->_tdTagName=$tagName; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function setContainer($container,$row){ |
39
|
|
|
$this->_container=$container; |
40
|
|
|
$this->_row=$row; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
View Code Duplication |
public function setValues($values=array()){ |
|
|
|
|
44
|
|
|
$count=$this->count(); |
45
|
|
|
if(\is_array($values)===false){ |
46
|
|
|
$values=\array_fill(0, $count, $values); |
47
|
|
|
} |
48
|
|
|
$count=\min(\sizeof($values),$count); |
49
|
|
|
|
50
|
|
|
for ($i=0;$i<$count;$i++){ |
51
|
|
|
$cell=$this->content[$i]; |
52
|
|
|
$cell->setValue($values[$i]); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function delete($index){ |
57
|
|
|
$this->removeItem($index); |
58
|
|
|
return $this; |
59
|
|
|
} |
60
|
|
|
} |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.