Completed
Push — master ( 848ec5...d8452d )
by Jean-Christophe
02:59
created

HtmlInput   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 5

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 2
cbo 5
dl 0
loc 25
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getField() 0 3 1
A getDataField() 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 function getDataField() {
26
		return $this->getField();
27
	}
28
29
	public static function outline($identifier, $icon, $value="", $placeholder="") {
30
		$result=new HtmlInput($identifier, "text", $value, $placeholder);
31
		$result->addToProperty("class", "transparent");
32
		$result->addIcon($icon)->setOutline();
33
		return $result;
34
	}
35
}