Completed
Push — master ( 66af5c...1d23a1 )
by Jean-Christophe
03:38
created

HtmlRating::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 4
nc 1
nop 4
1
<?php
2
3
namespace Ajax\semantic\html\modules;
4
5
use Ajax\semantic\html\base\HtmlSemDoubleElement;
6
use Ajax\JsUtils;
7
8
class HtmlRating extends HtmlSemDoubleElement {
9
	protected $_params=array();
10
	public function __construct($identifier, $value,$max=5,$icon="star") {
11
		parent::__construct($identifier, "div", "ui {$icon} rating");
12
		$this->setValue($value);
13
		$this->setMax($max);
14
	}
15
16
	/**
17
	 * {@inheritDoc}
18
	 * @see \Ajax\common\html\HtmlDoubleElement::setValue()
19
	 */
20
	public function setValue($value){
21
		$this->setProperty("data-rating", $value);
22
	}
23
24
	public function setMax($max){
25
		$this->setProperty("data-max-rating", $max);
26
	}
27
28
	/**
29
	 * {@inheritDoc}
30
	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
31
	 */
32
	public function run(JsUtils $js){
33
		parent::run($js);
34
		return $js->semantic()->rating("#".$this->identifier,$this->_params);
35
	}
36
}