Passed
Push — master ( 39f3dd...5f0b05 )
by Jean-Christophe
07:53
created

Slider   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 15
c 2
b 0
f 0
dl 0
loc 47
rs 10
wmc 11

11 Methods

Rating   Name   Duplication   Size   Complexity  
A setMin() 0 2 1
A setMax() 0 2 1
A __construct() 0 3 1
A setOnChange() 0 2 1
A setOnMove() 0 2 1
A setSmooth() 0 2 1
A setInterpretLabel() 0 4 1
A close() 0 2 1
A setStep() 0 2 1
A setEnd() 0 2 1
A setStart() 0 2 1
1
<?php
2
3
namespace Ajax\semantic\components;
4
5
use Ajax\JsUtils;
6
use Ajax\service\JString;
7
8
/**
9
 * Ajax\semantic\components$Slider
10
 * This class is part of phpMv-ui
11
 * @author jcheron <[email protected]>
12
 * @version 1.0.0
13
 * @since 2.3.0
14
 * @see https://fomantic-ui.com/modules/slider.html
15
 */
16
class Slider extends SimpleSemExtComponent {
17
18
	public function __construct(JsUtils $js=NULL) {
19
		parent::__construct($js);
20
		$this->uiName='slider';
21
	}
22
23
	public function close(){
24
		return $this->addBehavior('close');
25
	}
26
27
	public function setInterpretLabel($labels){
28
		$var="window.document._slider_labels['".JString::cleanIdentifier($this->attachTo)."']";
29
		$this->addCode('window.document._slider_labels=window.document._slider_labels||[];'.$var.'='.\json_encode($labels).';');
30
		$this->params['interpretLabel']='%function(value) {return '.$var.'[value];}%';
31
	}
32
	
33
	public function setMin($min){
34
		$this->params['min']=$min;
35
	}
36
	
37
	public function setMax($max){
38
		$this->params['max']=$max;
39
	}
40
	
41
	public function setStart($start){
42
		$this->params['start']=$start;
43
	}
44
	
45
	public function setEnd($end){
46
		$this->params['end']=$end;
47
	}
48
	
49
	public function setStep($step){
50
		$this->params['step']=$step;
51
	}
52
53
	public function setSmooth($smooth) {
54
		$this->params['smooth']=$smooth;
55
	}
56
	
57
	public function setOnChange($jsCode) {
58
		$this->addComponentEvent('onChange', $jsCode);
59
	}
60
	
61
	public function setOnMove($jsCode) {
62
		$this->addComponentEvent('onMove', $jsCode);
63
	}
64
65
}
66