Passed
Push — master ( 69a286...79b252 )
by Jean-Christophe
02:31
created
Ajax/semantic/html/collections/form/HtmlFormField.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -19,38 +19,38 @@  discard block
 block discarded – undo
19 19
 
20 20
 	protected $_validation;
21 21
 
22
-	public function __construct($identifier, $field, $label = NULL) {
22
+	public function __construct($identifier, $field, $label=NULL) {
23 23
 		parent::__construct($identifier, "div", "field");
24
-		$this->content = array();
25
-		$this->_states = [
24
+		$this->content=array();
25
+		$this->_states=[
26 26
 			State::ERROR,
27 27
 			State::DISABLED
28 28
 		];
29
-		if (isset($label) && $label !== "")
29
+		if (isset($label) && $label!=="")
30 30
 			$this->setLabel($label);
31 31
 		$this->setField($field);
32
-		$this->_validation = NULL;
32
+		$this->_validation=NULL;
33 33
 	}
34 34
 
35
-	public function addPointingLabel($label, $pointing = Direction::NONE) {
36
-		$labelO = new HtmlLabel("", $label);
35
+	public function addPointingLabel($label, $pointing=Direction::NONE) {
36
+		$labelO=new HtmlLabel("", $label);
37 37
 		$labelO->setPointing($pointing);
38
-		$this->addContent($labelO, $pointing === "below" || $pointing === "right");
38
+		$this->addContent($labelO, $pointing==="below" || $pointing==="right");
39 39
 		return $labelO;
40 40
 	}
41 41
 
42 42
 	public function setLabel($label) {
43
-		$labelO = $label;
43
+		$labelO=$label;
44 44
 		if (\is_string($label)) {
45
-			$labelO = new HtmlSemDoubleElement("", "label", "");
45
+			$labelO=new HtmlSemDoubleElement("", "label", "");
46 46
 			$labelO->setContent($label);
47 47
 			$labelO->setProperty("for", \str_replace("field-", "", $this->identifier));
48 48
 		}
49
-		$this->content["label"] = $labelO;
49
+		$this->content["label"]=$labelO;
50 50
 	}
51 51
 
52 52
 	public function setField($field) {
53
-		$this->content["field"] = $field;
53
+		$this->content["field"]=$field;
54 54
 	}
55 55
 
56 56
 	/**
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	 * puts the label before or behind
86 86
 	 */
87 87
 	public function swapLabel() {
88
-		$label = $this->getLabel();
88
+		$label=$this->getLabel();
89 89
 		unset($this->content["label"]);
90
-		$this->content["label"] = $label;
90
+		$this->content["label"]=$label;
91 91
 	}
92 92
 
93 93
 	/**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function setWidth($width) {
100 100
 		if (\is_int($width)) {
101
-			$width = Wide::getConstants()["W" . $width];
101
+			$width=Wide::getConstants()["W".$width];
102 102
 		}
103 103
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
104 104
 		if (isset($this->_container)) {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	public function setContainer($_container) {
130
-		$this->_container = $_container;
130
+		$this->_container=$_container;
131 131
 		return $this;
132 132
 	}
133 133
 
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
 		$this->getDataField()->setProperty("readonly", "");
136 136
 	}
137 137
 
138
-	public function addRule($type, $prompt = NULL, $value = NULL) {
139
-		$field = $this->getDataField();
138
+	public function addRule($type, $prompt=NULL, $value=NULL) {
139
+		$field=$this->getDataField();
140 140
 		if (isset($field)) {
141
-			if (! isset($this->_validation)) {
142
-				$this->_validation = new FieldValidation($field->getIdentifier());
141
+			if (!isset($this->_validation)) {
142
+				$this->_validation=new FieldValidation($field->getIdentifier());
143 143
 			}
144
-			if($type instanceof Rule){
145
-				if($type->getType()=='empty'){
144
+			if ($type instanceof Rule) {
145
+				if ($type->getType()=='empty') {
146 146
 					$this->addToProperty('class', 'required');
147 147
 				}
148
-			}elseif ($type === 'empty' || ($type['type'] ?? '') === 'empty') {
148
+			}elseif ($type==='empty' || ($type['type'] ?? '')==='empty') {
149 149
 				$this->addToProperty('class', 'required');
150 150
 			}
151 151
 			$this->_validation->addRule($type, $prompt, $value);
@@ -153,11 +153,11 @@  discard block
 block discarded – undo
153 153
 		return $this;
154 154
 	}
155 155
 
156
-	public function setOptional($optional = true) {
157
-		$field = $this->getDataField();
156
+	public function setOptional($optional=true) {
157
+		$field=$this->getDataField();
158 158
 		if (isset($field)) {
159
-			if (! isset($this->_validation)) {
160
-				$this->_validation = new FieldValidation($field->getIdentifier());
159
+			if (!isset($this->_validation)) {
160
+				$this->_validation=new FieldValidation($field->getIdentifier());
161 161
 			}
162 162
 			$this->_validation->setOptional($optional);
163 163
 		}
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 
173 173
 	public function setRules(array $rules) {
174
-		$this->_validation = null;
174
+		$this->_validation=null;
175 175
 		return $this->addRules($rules);
176 176
 	}
177 177
 
178
-	public function addIcon($icon, $direction = Direction::LEFT) {
179
-		$field = $this->getField();
178
+	public function addIcon($icon, $direction=Direction::LEFT) {
179
+		$field=$this->getField();
180 180
 		return $field->addIcon($icon, $direction);
181 181
 	}
182 182
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,8 +26,9 @@  discard block
 block discarded – undo
26 26
 			State::ERROR,
27 27
 			State::DISABLED
28 28
 		];
29
-		if (isset($label) && $label !== "")
30
-			$this->setLabel($label);
29
+		if (isset($label) && $label !== "") {
30
+					$this->setLabel($label);
31
+		}
31 32
 		$this->setField($field);
32 33
 		$this->_validation = NULL;
33 34
 	}
@@ -59,8 +60,9 @@  discard block
 block discarded – undo
59 60
 	 * @return mixed
60 61
 	 */
61 62
 	public function getLabel() {
62
-		if (\array_key_exists("label", $this->content))
63
-			return $this->content["label"];
63
+		if (\array_key_exists("label", $this->content)) {
64
+					return $this->content["label"];
65
+		}
64 66
 	}
65 67
 
66 68
 	/**
@@ -145,7 +147,7 @@  discard block
 block discarded – undo
145 147
 				if($type->getType()=='empty'){
146 148
 					$this->addToProperty('class', 'required');
147 149
 				}
148
-			}elseif ($type === 'empty' || ($type['type'] ?? '') === 'empty') {
150
+			} elseif ($type === 'empty' || ($type['type'] ?? '') === 'empty') {
149 151
 				$this->addToProperty('class', 'required');
150 152
 			}
151 153
 			$this->_validation->addRule($type, $prompt, $value);
Please login to merge, or discard this patch.
Ajax/semantic/components/SimpleSemExtComponent.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 		return $this;
18 18
 	}
19 19
 	
20
-	protected function generateParamParts(){
20
+	protected function generateParamParts() {
21 21
 		$results=[];
22
-		foreach ($this->paramParts as $paramPart){
22
+		foreach ($this->paramParts as $paramPart) {
23 23
 			$results[]="{$this->uiName}(".\implode(",", $paramPart).")";
24 24
 		}
25 25
 		return \implode(".", $results);
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 
28 28
 	public function getScript() {
29 29
 		$allParams=$this->params;
30
-		$this->jquery_code_for_compile=array ();
30
+		$this->jquery_code_for_compile=array();
31 31
 		$this->compileJsCodes();
32 32
 		$paramParts="";
33
-		if(\sizeof($this->paramParts)>0){
33
+		if (\sizeof($this->paramParts)>0) {
34 34
 			$paramParts=".".$this->generateParamParts();
35 35
 		}
36 36
 		$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).")".$paramParts.";";
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 		return $this;
44 44
 	}
45 45
 
46
-	public function addComponentEvent($event,$jsCode){
47
-		$jsCode=\str_ireplace("\"","%quote%", $jsCode);
46
+	public function addComponentEvent($event, $jsCode) {
47
+		$jsCode=\str_ireplace("\"", "%quote%", $jsCode);
48 48
 		return $this->setParam($event, "%function(module){".$jsCode."}%");
49 49
 	}
50 50
 	
51
-	public function setJs(JsUtils $js){
51
+	public function setJs(JsUtils $js) {
52 52
 		$this->js=$js;
53 53
 		$js->semantic()->addComponent($this, $this->attachTo, $this->params);
54 54
 	}
Please login to merge, or discard this patch.
Ajax/semantic/components/Toast.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -19,75 +19,75 @@
 block discarded – undo
19 19
 		$this->uiName='toast';
20 20
 	}
21 21
 
22
-	public function close(){
22
+	public function close() {
23 23
 		return $this->addBehavior('close');
24 24
 	}
25 25
 
26
-	public function setClass($value){
26
+	public function setClass($value) {
27 27
 		$this->params['class']=$value;
28 28
 		return $this;
29 29
 	}
30 30
 	
31
-	public function setCloseIcon(){
31
+	public function setCloseIcon() {
32 32
 		$this->params['closeIcon']=true;
33 33
 		return $this;
34 34
 	}
35 35
 	
36
-	public function setShowIcon($value=false){
36
+	public function setShowIcon($value=false) {
37 37
 		$this->params['showIcon']=$value;
38 38
 		return $this;
39 39
 	}
40 40
 
41
-	public function setPreserveHTML($value=false){
41
+	public function setPreserveHTML($value=false) {
42 42
 		$this->params['preserveHTML']=$value;
43 43
 		return $this;
44 44
 	}
45 45
 	
46
-	public function setCloseOnClick($value){
46
+	public function setCloseOnClick($value) {
47 47
 		$this->params['closeOnClick']=$value;
48 48
 		return $this;
49 49
 	}
50 50
 	
51
-	public function setTitle($title){
51
+	public function setTitle($title) {
52 52
 		$this->params['title']=$title;
53 53
 		return $this;
54 54
 	}
55 55
 
56
-	public function setActions(array $actions){
57
-		foreach ($actions as &$action){
58
-			if(isset($action['click'])){
59
-				$js=\str_ireplace("\"","%quote%", $action['click']);
56
+	public function setActions(array $actions) {
57
+		foreach ($actions as &$action) {
58
+			if (isset($action['click'])) {
59
+				$js=\str_ireplace("\"", "%quote%", $action['click']);
60 60
 				$action['click']="%function(){".$js."}%";
61 61
 			}
62 62
 		}
63 63
 		$this->params['actions']=$actions;
64
-		if(count($actions)>0) {
65
-			$this->params['displayTime'] = 0;
64
+		if (count($actions)>0) {
65
+			$this->params['displayTime']=0;
66 66
 		}
67 67
 		return $this;
68 68
 	}
69 69
 	
70
-	public function setMessage($message){
70
+	public function setMessage($message) {
71 71
 		$this->params['message']=$message;
72 72
 		return $this;
73 73
 	}
74 74
 	
75
-	public function setPosition($position){
75
+	public function setPosition($position) {
76 76
 		$this->params['position']=$position;
77 77
 		return $this;
78 78
 	}
79 79
 	
80
-	public function setDisplayTime($time){
80
+	public function setDisplayTime($time) {
81 81
 		$this->params['displayTime']=$time;
82 82
 		return $this;
83 83
 	}
84 84
 	
85
-	public function setShowProgress($value='top'){
85
+	public function setShowProgress($value='top') {
86 86
 		$this->params['showProgress']=$value;
87 87
 		return $this;
88 88
 	}
89 89
 	
90
-	public function setClassProgress($value){
90
+	public function setClassProgress($value) {
91 91
 		$this->params['classProgress']=$value;
92 92
 		return $this;
93 93
 	}
Please login to merge, or discard this patch.
Ajax/common/components/BaseComponent.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
  * @version 1.001
11 11
  */
12 12
 abstract class BaseComponent {
13
-	public $jquery_code_for_compile=array ();
14
-	protected $params=array ();
13
+	public $jquery_code_for_compile=array();
14
+	protected $params=array();
15 15
 
16 16
 	/**
17 17
 	 *
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 	}
69 69
 
70 70
 	public function setParams($params) {
71
-		if(\is_array($params)) {
71
+		if (\is_array($params)) {
72 72
 			foreach ($params as $k => $v) {
73
-				$method = "set" . ucfirst($k);
73
+				$method="set".ucfirst($k);
74 74
 				if (method_exists($this, $method))
75 75
 					$this->$method($v);
76 76
 				else {
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 		return $this;
84 84
 	}
85 85
 
86
-	public function addParams($params){
87
-		foreach ($params as $k=>$v){
86
+	public function addParams($params) {
87
+		foreach ($params as $k=>$v) {
88 88
 				$this->setParam($k, $v);
89 89
 		}
90 90
 		return $this;
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
 
93 93
 	abstract public function getScript();
94 94
 
95
-	public function setDebug($value){
95
+	public function setDebug($value) {
96 96
 		return $this->setParam("debug", $value);
97 97
 	}
98 98
 
99
-	public function setVerbose($value){
99
+	public function setVerbose($value) {
100 100
 		return $this->setParam("verbose", $value);
101 101
 	}
102 102
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
 
40 40
 	public function getParam($key) {
41 41
 		$value=null;
42
-		if (array_key_exists($key, $this->params))
43
-			$value=$this->params [$key];
42
+		if (array_key_exists($key, $this->params)) {
43
+					$value=$this->params [$key];
44
+		}
44 45
 		return $value;
45 46
 	}
46 47
 
@@ -49,16 +50,18 @@  discard block
 block discarded – undo
49 50
 	}
50 51
 
51 52
 	public function compile(JsUtils $js=NULL) {
52
-		if ($js==NULL)
53
-			$js=$this->js;
53
+		if ($js==NULL) {
54
+					$js=$this->js;
55
+		}
54 56
 		$script=$this->getScript();
55 57
 		$js->addToCompile($script);
56 58
 	}
57 59
 
58 60
 	protected function setParamCtrl($key, $value, $typeCtrl) {
59 61
 		if (\is_array($typeCtrl)) {
60
-			if (array_search($value, $typeCtrl)===false)
61
-				throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
62
+			if (array_search($value, $typeCtrl)===false) {
63
+							throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
64
+			}
62 65
 		} else {
63 66
 			if (!$typeCtrl($value)) {
64 67
 				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key);
@@ -71,9 +74,9 @@  discard block
 block discarded – undo
71 74
 		if(\is_array($params)) {
72 75
 			foreach ($params as $k => $v) {
73 76
 				$method = "set" . ucfirst($k);
74
-				if (method_exists($this, $method))
75
-					$this->$method($v);
76
-				else {
77
+				if (method_exists($this, $method)) {
78
+									$this->$method($v);
79
+				} else {
77 80
 					$this->setParam($k, $v);
78 81
 					trigger_error("`{$k}` doesn't exists!", E_USER_NOTICE);
79 82
 				}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/business/BusinessForm.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,17 +16,17 @@  discard block
 block discarded – undo
16 16
 	 *
17 17
 	 * @see \Ajax\semantic\widgets\dataform\DataForm::__construct()
18 18
 	 */
19
-	public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) {
20
-		if(!isset($modelInstance)){
19
+	public function __construct($identifier, $modelInstance=null, $fieldsOrder=[], $fieldsDefinition=[], $fields=[], $captions=[], $separators=[]) {
20
+		if (!isset($modelInstance)) {
21 21
 			$modelInstance=$this->getDefaultModelInstance();
22 22
 		}
23
-		parent::__construct($identifier,$modelInstance);
24
-		$this->_initForm($fieldsOrder, $fieldsDefinition,$fields,$captions,$separators);
23
+		parent::__construct($identifier, $modelInstance);
24
+		$this->_initForm($fieldsOrder, $fieldsDefinition, $fields, $captions, $separators);
25 25
 	}
26 26
 
27 27
 	abstract protected function getDefaultModelInstance();
28 28
 
29
-	protected function _initForm($fieldsOrder,$fieldsDefinition,$fields=[],$captions=[],$separators=[]){
29
+	protected function _initForm($fieldsOrder, $fieldsDefinition, $fields=[], $captions=[], $separators=[]) {
30 30
 		$this->_fieldsOrder=$fieldsOrder;
31 31
 		$this->setFields($fields);
32 32
 		$this->setSeparators($separators);
@@ -34,26 +34,26 @@  discard block
 block discarded – undo
34 34
 		$this->setCaptions($captions);
35 35
 	}
36 36
 
37
-	protected function _getIndex($fieldName){
37
+	protected function _getIndex($fieldName) {
38 38
 		$index=$fieldName;
39
-		if(\is_string($fieldName)){
39
+		if (\is_string($fieldName)) {
40 40
 			$index=\array_search($fieldName, $this->_fieldsOrder);
41 41
 		}
42 42
 		return $index;
43 43
 	}
44
-	protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){
44
+	protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) {
45 45
 		$index=$this->_getIndex($index);
46
-		return parent::_fieldAs($elementCallback, $index,$attributes,$prefix);
46
+		return parent::_fieldAs($elementCallback, $index, $attributes, $prefix);
47 47
 	}
48 48
 
49 49
 
50
-	public function removeField($fieldName){
50
+	public function removeField($fieldName) {
51 51
 		parent::removeField($fieldName);
52
-		\array_splice($this->_fieldsOrder,$this->_getIndex($fieldName),1);
52
+		\array_splice($this->_fieldsOrder, $this->_getIndex($fieldName), 1);
53 53
 		return $this;
54 54
 	}
55 55
 
56
-	public function compile(JsUtils $js=NULL,&$view=NULL){
57
-		return parent::compile($js,$view);
56
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
57
+		return parent::compile($js, $view);
58 58
 	}
59 59
 }
Please login to merge, or discard this patch.