Completed
Push — master ( 8b7375...189ad5 )
by Jean-Christophe
03:49
created

HtmlGridCol::addDivider()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

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