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

HtmlSegment::setTextAlignment()   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\elements;
4
5
use Ajax\semantic\html\base\HtmlSemDoubleElement;
6
use Ajax\semantic\html\base\constants\SegmentType;
7
use Ajax\semantic\html\base\traits\AttachedTrait;
8
use Ajax\semantic\html\base\constants\State;
9
use Ajax\semantic\html\base\constants\Variation;
10
use Ajax\semantic\html\base\constants\Emphasis;
11
use Ajax\semantic\html\base\traits\TextAlignmentTrait;
12
13
/**
14
 * Semantic Segment element
15
 * @see http://semantic-ui.com/elements/segment.html
16
 * @author jc
17
 * @version 1.001
18
 */
19
class HtmlSegment extends HtmlSemDoubleElement {
20
	use AttachedTrait,TextAlignmentTrait;
21
	public function __construct($identifier, $content="") {
22
		parent::__construct($identifier, "div","ui segment");
23
		$this->_variations=\array_merge($this->_variations,[Variation::PADDED,Variation::COMPACT]);
24
		$this->_states=\array_merge($this->_states,[State::LOADING]);
25
		$this->content=$content;
26
	}
27
28
	/**
29
	 * Defines the segment type
30
	 * @param string $type one of "raised","stacked","piled" default : ""
31
	 * @return \Ajax\semantic\html\elements\HtmlSegment
32
	 */
33
	public function setType($type){
34
		return $this->addToPropertyCtrl("class", $type, SegmentType::getConstants());
35
	}
36
37
	public function setSens($sens="vertical"){
38
		return $this->addToPropertyCtrl("class", $sens, array("vertical","horizontal"));
39
	}
40
41
42
	public function setEmphasis($value=Emphasis::SECONDARY){
43
		return $this->addToPropertyCtrl("class", $value, Emphasis::getConstants());
44
	}
45
46
	public function setCircular(){
47
		return $this->addToProperty("class", "circular");
48
	}
49
50
	public function clear(){
51
		return $this->addToProperty("class", "clearing");
52
	}
53
54
	public function setFloating($value="left"){
55
		return $this->addToPropertyCtrl("class", "floated ".$value,array("floated right","floated left"));
56
	}
57
58
	public function setCompact(){
59
		return $this->addToProperty("class", "compact");
60
	}
61
62
	public function setBasic(){
63
		return $this->setProperty("class", "ui basic segment");
64
	}
65
66
}