Completed
Push — master ( e6529d...cd0fd2 )
by Jean-Christophe
03:35
created

HtmlGridCol::setTextAlignment()   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
use Ajax\semantic\html\base\TextAlignment;
8
9
/**
10
 * A col in the Semantic Grid component
11
 * @see http://semantic-ui.com/collections/grid.html
12
 * @author jc
13
 * @version 1.001
14
 */
15
class HtmlGridCol extends HtmlSemDoubleElement{
16
	public function __construct($identifier,$width){
17
		parent::__construct($identifier,"div");
18
		$this->setClass("column");
19
		if(isset($width))
20
			$this->setWidth($width);
21
	}
22
23
	/**
24
	 * Defines the col width
25
	 * @param int $width
26
	 * @return \Ajax\semantic\html\content\HtmlGridCol
27
	 */
28 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...
29
		if(\is_int($width)){
30
			$width=Wide::getConstants()["W".$width];
31
		}
32
		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
33
		return $this->addToPropertyCtrl("class", "wide",array("wide"));
34
	}
35
36
	/**
37
	 * Defines the coll floating
38
	 * @param string $value left or right
39
	 * @return \Ajax\semantic\html\content\HtmlGridCol
40
	 */
41
	public function setFloated($value="left"){
42
		return $this->addToProperty("class", $value." floated");
43
	}
44
45
	public function setTextAlignment($value=TextAlignment::LEFT){
46
		return $this->addToPropertyCtrl("class", $value,TextAlignment::getConstants());
47
	}
48
49
	public function setValue($value){
50
		$this->content=$value;
51
	}
52
}