Completed
Push — master ( db82f0...0ba4b1 )
by Jean-Christophe
03:22
created

HtmlGridCol::setValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
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\constants\Wide;
7
use Ajax\semantic\html\base\traits\TextAlignmentTrait;
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
	use TextAlignmentTrait;
17
	public function __construct($identifier,$width){
18
		parent::__construct($identifier,"div");
19
		$this->setClass("column");
20
		if(isset($width))
21
			$this->setWidth($width);
22
	}
23
24
	/**
25
	 * Defines the col width
26
	 * @param int $width
27
	 * @return \Ajax\semantic\html\content\HtmlGridCol
28
	 */
29 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...
30
		if(\is_int($width)){
31
			$width=Wide::getConstants()["W".$width];
32
		}
33
		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
34
		return $this->addToPropertyCtrl("class", "wide",array("wide"));
35
	}
36
37
	/**
38
	 * Defines the coll floating
39
	 * @param string $value left or right
40
	 * @return \Ajax\semantic\html\content\HtmlGridCol
41
	 */
42
	public function setFloated($value="left"){
43
		return $this->addToProperty("class", $value." floated");
44
	}
45
46
47
	public function setValue($value){
48
		$this->content=$value;
49
	}
50
}