Completed
Push — master ( 8466ff...9e5b24 )
by Jean-Christophe
03:04
created

HtmlGridCol::setFloated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Ajax\semantic\html\content;
4
5
use Ajax\semantic\html\base\HtmlSemDoubleElement;
6
use Ajax\semantic\html\base\Wide;
7
/**
8
 * A col in the Semantic Grid component
9
 * @see http://semantic-ui.com/collections/grid.html
10
 * @author jc
11
 * @version 1.001
12
 */
13
class HtmlGridCol extends HtmlSemDoubleElement{
14
	public function __construct($identifier,$width){
15
		parent::__construct($identifier,"div");
16
		$this->setClass("column");
17
		if(isset($width))
18
			$this->setWidth($width);
19
	}
20
21
	/**
22
	 * Defines the col width
23
	 * @param int $width
24
	 * @return \Ajax\semantic\html\content\HtmlGridCol
25
	 */
26 View Code Duplication
	public function setWidth($width){
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
27
		if(\is_int($width)){
28
			$width=Wide::getConstants()["W".$width];
29
		}
30
		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
31
		return $this->addToPropertyCtrl("class", "wide",array("wide"));
32
	}
33
34
	/**
35
	 * Defines the coll floating
36
	 * @param string $value left or right
37
	 * @return \Ajax\semantic\html\content\HtmlGridCol
38
	 */
39
	public function setFloated($value="left"){
40
		return $this->addToProperty("class", $value." floated");
41
	}
42
}