Completed
Push — master ( 49f42f...848ec5 )
by Jean-Christophe
03:06
created

HtmlInput   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 5

Importance

Changes 0
Metric Value
wmc 3
lcom 2
cbo 5
dl 0
loc 21
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getField() 0 3 1
A outline() 0 6 1
1
<?php
2
namespace Ajax\semantic\html\elements;
3
4
use Ajax\semantic\html\base\HtmlSemDoubleElement;
5
use Ajax\semantic\html\base\constants\State;
6
use Ajax\semantic\html\base\constants\Variation;
7
use Ajax\semantic\html\base\traits\IconTrait;
8
use Ajax\semantic\html\collections\form\traits\TextFieldsTrait;
9
use Ajax\semantic\html\collections\form\traits\FieldTrait;
10
11
class HtmlInput extends HtmlSemDoubleElement {
12
	use IconTrait,TextFieldsTrait,FieldTrait;
13
14
	public function __construct($identifier, $type="text", $value="", $placeholder="") {
15
		parent::__construct("div-" . $identifier, "div", "ui input");
16
		$this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ];
17
		$this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ];
18
		$this->_variations=[ Variation::TRANSPARENT ];
19
	}
20
21
	public function getField() {
22
		return $this->content["field"];
23
	}
24
25
	public static function outline($identifier, $icon, $value="", $placeholder="") {
26
		$result=new HtmlInput($identifier, "text", $value, $placeholder);
27
		$result->addToProperty("class", "transparent");
28
		$result->addIcon($icon)->setOutline();
29
		return $result;
30
	}
31
}