Completed
Push — master ( 3ad5ef...acbd35 )
by Jean-Christophe
03:30
created

HtmlSticky   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 11
lcom 1
cbo 1
dl 0
loc 50
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A setContext() 0 4 1
A setFixed() 0 6 2
A setBound() 0 6 2
A run() 0 4 1
A setOffset() 0 4 1
A setDebug() 0 6 2
1
<?php
2
3
namespace Ajax\semantic\html\modules;
4
5
use Ajax\semantic\html\base\HtmlSemDoubleElement;
6
use Ajax\JsUtils;
7
8
class HtmlSticky extends HtmlSemDoubleElement {
9
10
	public function __construct($identifier,$context=NULL,$content=NULL) {
11
		parent::__construct($identifier, "div", "ui sticky", $content);
12
		if(isset($content))
13
			$this->setContext($context);
14
	}
15
16
	public function setContext($context){
17
		$this->_params["context"]=$context;
18
		return $this;
19
	}
20
21
	public function setFixed($value=NULL){
22
		$fixed="fixed";
23
		if(isset($value))
24
			$fixed.=" ".$value;
25
		return $this->addToProperty("class",$fixed);
26
	}
27
28
	public function setBound($value=NULL){
29
		$bound="bound";
30
		if(isset($value))
31
			$bound.=" ".$value;
32
			return $this->addToProperty("class",$bound);
33
	}
34
35
	/**
36
	 * {@inheritDoc}
37
	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
38
	 */
39
	public function run(JsUtils $js){
40
		parent::run($js);
41
		return $js->semantic()->sticky("#".$this->identifier,$this->_params);
42
	}
43
44
	public function setOffset($offset=0){
45
		$this->_params["offset"]=$offset;
46
		return $this;
47
	}
48
49
50
51
	public function setDebug($verbose=NULL){
52
		$this->_params["debug"]=true;
53
		if(isset($verbose))
54
			$this->_params["verbose"]=true;
55
		return $this;
56
	}
57
}