Completed
Push — master ( 03d1b2...8466ff )
by Jean-Christophe
03:11
created

HtmlGridRow   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 34
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 4
A getCol() 0 3 1
A createItem() 0 4 1
1
<?php
2
3
namespace Ajax\semantic\html\content;
4
5
use Ajax\common\html\html5\HtmlCollection;
6
7
class HtmlGridRow extends HtmlCollection{
8
9
	private $_colSize;
10
	public function __construct( $identifier,$numCols=NULL,$colSizing=false){
11
		parent::__construct( $identifier,"div");
12
		$this->setClass("row");
13
		$width=null;
14
		if(isset($numCols)){
15
			$numCols=min(16,$numCols);
16
			$numCols=max(1,$numCols);
17
			if($colSizing)
18
				$width=(int)(16/$numCols);
19
			else
20
				$this->_colSize=16/$numCols;
21
			for ($i=0;$i<$numCols;$i++){
22
				$this->addItem($width);
23
			}
24
		}
25
	}
26
27
	/**
28
	 * return the col at $index
29
	 * @param int $index
30
	 * @return \Ajax\semantic\html\collections\HtmlGridCol
31
	 */
32
	public function getCol($index){
33
		return $this->getItem($index);
34
	}
35
36
	protected function createItem($value){
37
		$col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value);
38
		return $col;
39
	}
40
}