Completed
Push — master ( 70601d...0c3815 )
by Jean-Christophe
03:29
created

HtmlGridCol::setWidth()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 7
loc 7
rs 9.4285
cc 2
eloc 5
nc 2
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
use Ajax\semantic\html\base\constants\Direction;
9
10
/**
11
 * A col in the Semantic Grid component
12
 * @see http://semantic-ui.com/collections/grid.html
13
 * @author jc
14
 * @version 1.001
15
 */
16
class HtmlGridCol extends HtmlSemDoubleElement{
17
	use TextAlignmentTrait;
18
	public function __construct($identifier,$width=NULL){
19
		parent::__construct($identifier,"div");
20
		$this->setClass("column");
21
		if(isset($width))
22
			$this->setWidth($width);
23
	}
24
25
	/**
26
	 * Defines the col width
27
	 * @param int $width
28
	 * @return \Ajax\semantic\html\content\HtmlGridCol
29
	 */
30 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...
31
		if(\is_int($width)){
32
			$width=Wide::getConstants()["W".$width];
33
		}
34
		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
35
		return $this->addToPropertyCtrl("class", "wide",array("wide"));
36
	}
37
38
	/**
39
	 * Defines the coll floating
40
	 * @param Direction $value left or right
41
	 * @return \Ajax\semantic\html\content\HtmlGridCol
42
	 */
43
	public function setFloated($value="left"){
44
		return $this->addToPropertyCtrl("class", $value." floated",Direction::getConstantValues("floated"));
45
	}
46
47
48
	public function setValue($value){
49
		$this->content=$value;
50
		return $this;
51
	}
52
53
	public function setValues($value){
54
		return $this->setValue($value);
55
	}
56
}