Passed
Push — master ( 695c9a...8412f6 )
by Jean-Christophe
02:29
created
Ajax/semantic/html/collections/form/HtmlFormField.php 2 patches
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -18,38 +18,38 @@  discard block
 block discarded – undo
18 18
 
19 19
 	protected $_validation;
20 20
 
21
-	public function __construct($identifier, $field, $label = NULL) {
21
+	public function __construct($identifier, $field, $label=NULL) {
22 22
 		parent::__construct($identifier, "div", "field");
23
-		$this->content = array();
24
-		$this->_states = [
23
+		$this->content=array();
24
+		$this->_states=[
25 25
 			State::ERROR,
26 26
 			State::DISABLED
27 27
 		];
28
-		if (isset($label) && $label !== "")
28
+		if (isset($label) && $label!=="")
29 29
 			$this->setLabel($label);
30 30
 		$this->setField($field);
31
-		$this->_validation = NULL;
31
+		$this->_validation=NULL;
32 32
 	}
33 33
 
34
-	public function addPointingLabel($label, $pointing = Direction::NONE) {
35
-		$labelO = new HtmlLabel("", $label);
34
+	public function addPointingLabel($label, $pointing=Direction::NONE) {
35
+		$labelO=new HtmlLabel("", $label);
36 36
 		$labelO->setPointing($pointing);
37
-		$this->addContent($labelO, $pointing === "below" || $pointing === "right");
37
+		$this->addContent($labelO, $pointing==="below" || $pointing==="right");
38 38
 		return $labelO;
39 39
 	}
40 40
 
41 41
 	public function setLabel($label) {
42
-		$labelO = $label;
42
+		$labelO=$label;
43 43
 		if (\is_string($label)) {
44
-			$labelO = new HtmlSemDoubleElement("", "label", "");
44
+			$labelO=new HtmlSemDoubleElement("", "label", "");
45 45
 			$labelO->setContent($label);
46 46
 			$labelO->setProperty("for", \str_replace("field-", "", $this->identifier));
47 47
 		}
48
-		$this->content["label"] = $labelO;
48
+		$this->content["label"]=$labelO;
49 49
 	}
50 50
 
51 51
 	public function setField($field) {
52
-		$this->content["field"] = $field;
52
+		$this->content["field"]=$field;
53 53
 	}
54 54
 
55 55
 	/**
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 	 * puts the label before or behind
85 85
 	 */
86 86
 	public function swapLabel() {
87
-		$label = $this->getLabel();
87
+		$label=$this->getLabel();
88 88
 		unset($this->content["label"]);
89
-		$this->content["label"] = $label;
89
+		$this->content["label"]=$label;
90 90
 	}
91 91
 
92 92
 	/**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function setWidth($width) {
99 99
 		if (\is_int($width)) {
100
-			$width = Wide::getConstants()["W" . $width];
100
+			$width=Wide::getConstants()["W".$width];
101 101
 		}
102 102
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
103 103
 		if (isset($this->_container)) {
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	}
127 127
 
128 128
 	public function setContainer($_container) {
129
-		$this->_container = $_container;
129
+		$this->_container=$_container;
130 130
 		return $this;
131 131
 	}
132 132
 
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 		$this->getDataField()->setProperty("readonly", "");
135 135
 	}
136 136
 
137
-	public function addRule($type, $prompt = NULL, $value = NULL) {
138
-		$field = $this->getDataField();
137
+	public function addRule($type, $prompt=NULL, $value=NULL) {
138
+		$field=$this->getDataField();
139 139
 		if (isset($field)) {
140
-			if (! isset($this->_validation)) {
141
-				$this->_validation = new FieldValidation($field->getIdentifier());
140
+			if (!isset($this->_validation)) {
141
+				$this->_validation=new FieldValidation($field->getIdentifier());
142 142
 			}
143
-			if ($type === 'empty' || ($type['type'] ?? '') === 'empty') {
143
+			if ($type==='empty' || ($type['type'] ?? '')==='empty') {
144 144
 				$this->addToProperty('class', 'required');
145 145
 			}
146 146
 			$this->_validation->addRule($type, $prompt, $value);
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 		return $this;
149 149
 	}
150 150
 
151
-	public function setOptional($optional = true) {
152
-		$field = $this->getDataField();
151
+	public function setOptional($optional=true) {
152
+		$field=$this->getDataField();
153 153
 		if (isset($field)) {
154
-			if (! isset($this->_validation)) {
155
-				$this->_validation = new FieldValidation($field->getIdentifier());
154
+			if (!isset($this->_validation)) {
155
+				$this->_validation=new FieldValidation($field->getIdentifier());
156 156
 			}
157 157
 			$this->_validation->setOptional($optional);
158 158
 		}
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
 	}
167 167
 
168 168
 	public function setRules(array $rules) {
169
-		$this->_validation = null;
169
+		$this->_validation=null;
170 170
 		return $this->addRules($rules);
171 171
 	}
172 172
 
173
-	public function addIcon($icon, $direction = Direction::LEFT) {
174
-		$field = $this->getField();
173
+	public function addIcon($icon, $direction=Direction::LEFT) {
174
+		$field=$this->getField();
175 175
 		return $field->addIcon($icon, $direction);
176 176
 	}
177 177
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
 			State::ERROR,
26 26
 			State::DISABLED
27 27
 		];
28
-		if (isset($label) && $label !== "")
29
-			$this->setLabel($label);
28
+		if (isset($label) && $label !== "") {
29
+					$this->setLabel($label);
30
+		}
30 31
 		$this->setField($field);
31 32
 		$this->_validation = NULL;
32 33
 	}
@@ -58,8 +59,9 @@  discard block
 block discarded – undo
58 59
 	 * @return mixed
59 60
 	 */
60 61
 	public function getLabel() {
61
-		if (\array_key_exists("label", $this->content))
62
-			return $this->content["label"];
62
+		if (\array_key_exists("label", $this->content)) {
63
+					return $this->content["label"];
64
+		}
63 65
 	}
64 66
 
65 67
 	/**
Please login to merge, or discard this patch.