Completed
Push — master ( 263c12...bbe42f )
by Jean-Christophe
06:53
created
Ajax/bootstrap/html/HtmlForm.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -87,6 +87,9 @@
 block discarded – undo
87 87
 		return $result;
88 88
 	}
89 89
 
90
+	/**
91
+	 * @return string
92
+	 */
90 93
 	protected function getPrefix($element) {
91 94
 		$result="input_text";
92 95
 		foreach ( $this->formElementsPrefix as $k => $v ) {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 	public function __construct($identifier) {
17 17
 		parent::__construct($identifier, "form");
18 18
 		$this->_template='<form id="%identifier%" name="%identifier%" %properties%>%content%</form>';
19
-		$this->futureElements=array ();
20
-		$this->formGroups=array ();
19
+		$this->futureElements=array();
20
+		$this->formGroups=array();
21 21
 	}
22 22
 
23 23
 	/*
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
28 28
 		if (isset($js)) {
29 29
 			$this->formElementsPrefix=$js->config()->getVar("formElementsPrefix");
30
-			foreach ( $this->futureElements as $futureElement ) {
30
+			foreach ($this->futureElements as $futureElement) {
31 31
 				$futureElementValue=$this->getPrefix($futureElement);
32 32
 				$futureElementValues=explode("_", $futureElementValue);
33
-				switch($futureElementValues [0]) {
33
+				switch ($futureElementValues [0]) {
34 34
 					case "input":
35 35
 						$control=new HtmlInput($futureElement);
36 36
 						$control->setClass("form-control");
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 						$control->setLabel($label, false);
49 49
 						break;
50 50
 					case "select":
51
-						$control=new HtmlSelect($futureElement,"");
51
+						$control=new HtmlSelect($futureElement, "");
52 52
 						$control->setProperty("size", $futureElementValues [1]);
53 53
 						$control->setClass("form-control");
54 54
 						break;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 				$this->addElement($control);
62 62
 			}
63 63
 		}
64
-		foreach ( $this->formGroups as $group ) {
64
+		foreach ($this->formGroups as $group) {
65 65
 			$this->addContent($group);
66 66
 		}
67 67
 		return parent::compile($js, $view);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
 	protected function getPrefix($element) {
91 91
 		$result="input_text";
92
-		foreach ( $this->formElementsPrefix as $k => $v ) {
92
+		foreach ($this->formElementsPrefix as $k => $v) {
93 93
 			if (JString::startswith($element, $k)) {
94 94
 				$result=$v;
95 95
 				break;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 	public function getElement($name) {
121 121
 		$element=null;
122
-		foreach ( $this->formGroups as $group ) {
122
+		foreach ($this->formGroups as $group) {
123 123
 		}
124 124
 		return $element;
125 125
 	}
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * @see \Ajax\bootstrap\html\base\HtmlSingleElement::fromArray()
130 130
 	 */
131 131
 	public function fromArray($array) {
132
-		foreach ( $array as $value ) {
132
+		foreach ($array as $value) {
133 133
 			if (is_string($value)) {
134 134
 				$this->futureElements []=$value;
135 135
 			}
Please login to merge, or discard this patch.
Ajax/bootstrap/html/HtmlProgressbar.php 1 patch
Doc Comments   +16 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,6 +19,9 @@  discard block
 block discarded – undo
19 19
 	protected $style="";
20 20
 	protected $styleLimits=null;
21 21
 
22
+	/**
23
+	 * @param string $identifier
24
+	 */
22 25
 	public function __construct($identifier, $style="info", $value=0, $max=100, $min=0) {
23 26
 		parent::__construct($identifier);
24 27
 		$this->_template=include 'templates/tplProgressbar.php';
@@ -28,6 +31,9 @@  discard block
 block discarded – undo
28 31
 		$this->setStyle($style);
29 32
 	}
30 33
 
34
+	/**
35
+	 * @param boolean $value
36
+	 */
31 37
 	public function setActive($value) {
32 38
 		if(\is_array($this->content)){
33 39
 			foreach ($this->content as $pb){
@@ -42,6 +48,9 @@  discard block
 block discarded – undo
42 48
 		return $this;
43 49
 	}
44 50
 
51
+	/**
52
+	 * @param boolean $value
53
+	 */
45 54
 	public function setStriped($value) {
46 55
 		if(\is_array($this->content)){
47 56
 			foreach ($this->content as $pb){
@@ -56,6 +65,9 @@  discard block
 block discarded – undo
56 65
 		return $this;
57 66
 	}
58 67
 
68
+	/**
69
+	 * @param boolean $value
70
+	 */
59 71
 	public function showCaption($value) {
60 72
 		if(\is_array($this->content)){
61 73
 			foreach ($this->content as $pb){
@@ -113,6 +125,9 @@  discard block
 block discarded – undo
113 125
 		return $this->stacked;
114 126
 	}
115 127
 
128
+	/**
129
+	 * @param boolean $stacked
130
+	 */
116 131
 	public function setStacked($stacked) {
117 132
 		$this->stacked=$stacked;
118 133
 		return $this;
@@ -121,7 +136,7 @@  discard block
 block discarded – undo
121 136
 	/**
122 137
 	 * define the progressbar style
123 138
 	 * avaible values : "success","info","warning","danger"
124
-	 * @param string|int $cssStyle
139
+	 * @param string $cssStyle
125 140
 	 * @return \Ajax\bootstrap\html\HtmlProgressbar default : ""
126 141
 	 */
127 142
 	public function setStyle($cssStyle) {
Please login to merge, or discard this patch.
Ajax/common/components/SimpleComponent.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,27 +18,27 @@  discard block
 block discarded – undo
18 18
 
19 19
 	public function __construct(JsUtils $js=NULL) {
20 20
 		parent::__construct($js);
21
-		$this->events=array ();
21
+		$this->events=array();
22 22
 	}
23 23
 
24 24
 	protected function compileEvents() {
25
-		foreach ( $this->events as $event => $jsCode ) {
25
+		foreach ($this->events as $event => $jsCode) {
26 26
 			$itemSelector=JString::getValueBetween($event);
27
-			if($event=="execute"){
27
+			if ($event=="execute") {
28 28
 				$this->jquery_code_for_compile []=$jsCode;
29
-			}else if($event=="beforeExecute"){
29
+			} else if ($event=="beforeExecute") {
30 30
 				\array_unshift($this->jquery_code_for_compile, $jsCode);
31
-			}else{
31
+			} else {
32 32
 				$selector=$this->_createSelector($itemSelector, $this->attachTo);
33 33
 				$this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
34 34
 			}
35 35
 		}
36 36
 	}
37 37
 
38
-	protected function _createSelector($itemSelector,$selector){
39
-		if(!isset($itemSelector))
38
+	protected function _createSelector($itemSelector, $selector) {
39
+		if (!isset($itemSelector))
40 40
 			$itemSelector=$this->itemSelector;
41
-		if(isset($itemSelector) && $itemSelector!=="")
41
+		if (isset($itemSelector) && $itemSelector!=="")
42 42
 			$selector.=" ".$itemSelector;
43 43
 		return $selector;
44 44
 	}
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		$result=implode("\n", $this->jquery_code_for_compile);
48 48
 		$result=str_ireplace("\"%", "", $result);
49 49
 		$result=str_ireplace("%\"", "", $result);
50
-		$result=str_replace(array (
50
+		$result=str_replace(array(
51 51
 				"\\n",
52 52
 				"\\r",
53 53
 				"\\t"
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public function getScript() {
59 59
 		$allParams=$this->params;
60
-		$this->jquery_code_for_compile=array ();
60
+		$this->jquery_code_for_compile=array();
61 61
 		$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).");";
62 62
 		$this->compileEvents();
63 63
 		return $this->compileJQueryCode();
Please login to merge, or discard this patch.
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 			$itemSelector=JString::getValueBetween($event);
27 27
 			if($event=="execute"){
28 28
 				$this->jquery_code_for_compile []=$jsCode;
29
-			}else if($event=="beforeExecute"){
29
+			} else if($event=="beforeExecute"){
30 30
 				\array_unshift($this->jquery_code_for_compile, $jsCode);
31
-			}else{
31
+			} else{
32 32
 				$selector=$this->_createSelector($itemSelector, $this->attachTo);
33 33
 				$this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
34 34
 			}
@@ -36,10 +36,12 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	protected function _createSelector($itemSelector,$selector){
39
-		if(!isset($itemSelector))
40
-			$itemSelector=$this->itemSelector;
41
-		if(isset($itemSelector) && $itemSelector!=="")
42
-			$selector.=" ".$itemSelector;
39
+		if(!isset($itemSelector)) {
40
+					$itemSelector=$this->itemSelector;
41
+		}
42
+		if(isset($itemSelector) && $itemSelector!=="") {
43
+					$selector.=" ".$itemSelector;
44
+		}
43 45
 		return $selector;
44 46
 	}
45 47
 
@@ -82,8 +84,9 @@  discard block
 block discarded – undo
82 84
 
83 85
 	protected function setParamCtrl($key, $value, $typeCtrl) {
84 86
 		if (\is_array($typeCtrl)) {
85
-			if (array_search($value, $typeCtrl)===false)
86
-				throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
87
+			if (array_search($value, $typeCtrl)===false) {
88
+							throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
89
+			}
87 90
 		} else {
88 91
 			if (!$typeCtrl($value)) {
89 92
 				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName);
Please login to merge, or discard this patch.
Ajax/service/JArray.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 class JArray {
6 6
 
7 7
 	public static function isAssociative($array) {
8
-		return (array_values($array) !== $array);
8
+		return (array_values($array)!==$array);
9 9
 	}
10 10
 
11 11
 	public static function getValue($array, $key, $pos) {
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 			return $array[$key];
14 14
 		}
15 15
 		$values=array_values($array);
16
-		if ($pos < sizeof($values))
16
+		if ($pos<sizeof($values))
17 17
 			return $values[$pos];
18 18
 	}
19 19
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 		$result=NULL;
22 22
 		if (array_key_exists($key, $array)) {
23 23
 			$result=$array[$key];
24
-			if ($condition($result) === true)
24
+			if ($condition($result)===true)
25 25
 				return $result;
26 26
 		}
27 27
 		$values=array_values($array);
28
-		foreach ( $values as $val ) {
29
-			if ($condition($val) === true)
28
+		foreach ($values as $val) {
29
+			if ($condition($val)===true)
30 30
 				return $val;
31 31
 		}
32 32
 		return $result;
@@ -43,11 +43,11 @@  discard block
 block discarded – undo
43 43
 		$result="";
44 44
 		if (\is_array($glue)) {
45 45
 			$size=\sizeof($pieces);
46
-			if ($size > 0) {
47
-				for($i=0; $i < $size - 1; $i++) {
48
-					$result.=$pieces[$i] . @$glue[$i];
46
+			if ($size>0) {
47
+				for ($i=0; $i<$size-1; $i++) {
48
+					$result.=$pieces[$i].@$glue[$i];
49 49
 				}
50
-				$result.=$pieces[$size - 1];
50
+				$result.=$pieces[$size-1];
51 51
 			}
52 52
 		} else {
53 53
 			$result=\implode($glue, $pieces);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public static function dimension($array) {
59 59
 		if (\is_array(reset($array))) {
60
-			$return=self::dimension(reset($array)) + 1;
60
+			$return=self::dimension(reset($array))+1;
61 61
 		} else {
62 62
 			$return=1;
63 63
 		}
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	}
66 66
 
67 67
 	public static function sortAssociative($array, $sortedKeys=array()) {
68
-		$newArray=array ();
69
-		foreach ( $sortedKeys as $key ) {
68
+		$newArray=array();
69
+		foreach ($sortedKeys as $key) {
70 70
 			if (\array_key_exists($key, $array)) {
71 71
 				$newArray[$key]=$array[$key];
72 72
 			}
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 
77 77
 	public static function moveElementTo(&$array, $from, $to) {
78 78
 		$result=false;
79
-		if(isset($array)){
80
-			if(isset($array[$from])){
81
-				$out = array_splice($array, $from, 1);
79
+		if (isset($array)) {
80
+			if (isset($array[$from])) {
81
+				$out=array_splice($array, $from, 1);
82 82
 				array_splice($array, $to, 0, $out);
83 83
 				$result=true;
84 84
 			}
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 		return $result;
87 87
 	}
88 88
 
89
-	public static function swapElements(&$array,$index1,$index2){
89
+	public static function swapElements(&$array, $index1, $index2) {
90 90
 		$result=false;
91
-		if(isset($array)){
92
-			if(isset($array[$index1])&& isset($array[$index2])){
91
+		if (isset($array)) {
92
+			if (isset($array[$index1]) && isset($array[$index2])) {
93 93
 				$tmp=$array[$index1];
94 94
 				$array[$index1]=$array[$index2];
95 95
 				$array[$index2]=$tmp;
@@ -100,27 +100,27 @@  discard block
 block discarded – undo
100 100
 	}
101 101
 
102 102
 
103
-	public static function modelArray($objects,$identifierFunction=NULL,$modelFunction=NULL){
103
+	public static function modelArray($objects, $identifierFunction=NULL, $modelFunction=NULL) {
104 104
 		$result=[];
105
-		if(isset($modelFunction)===false){
105
+		if (isset($modelFunction)===false) {
106 106
 			$modelFunction="__toString";
107 107
 		}
108
-		if(isset($identifierFunction)===false){
109
-			foreach ($objects as $object){
108
+		if (isset($identifierFunction)===false) {
109
+			foreach ($objects as $object) {
110 110
 				$result[]=self::callFunction($object, $modelFunction);
111 111
 			}
112
-		}else{
113
-			foreach ($objects as $object){
112
+		} else {
113
+			foreach ($objects as $object) {
114 114
 				$result[self::callFunction($object, $identifierFunction)]=self::callFunction($object, $modelFunction);
115 115
 			}
116 116
 		}
117 117
 		return $result;
118 118
 	}
119 119
 
120
-	private static function callFunction($object,$callback){
121
-		if(\is_string($callback))
122
-			return \call_user_func(array($object, $callback),[]);
123
-		else if (\is_callable($callback)){
120
+	private static function callFunction($object, $callback) {
121
+		if (\is_string($callback))
122
+			return \call_user_func(array($object, $callback), []);
123
+		else if (\is_callable($callback)) {
124 124
 			return $callback($object);
125 125
 		}
126 126
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 2 patches
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -19,215 +19,215 @@  discard block
 block discarded – undo
19 19
 
20 20
 	public static $index=0;
21 21
 
22
-	public function __construct($identifier,$instance=NULL,$captions=NULL){
22
+	public function __construct($identifier, $instance=NULL, $captions=NULL) {
23 23
 		$this->widgetIdentifier=$identifier;
24 24
 		$this->values=[];
25 25
 		$this->afterCompile=[];
26
-		if(isset($instance))
26
+		if (isset($instance))
27 27
 			$this->setInstance($instance);
28 28
 		$this->setCaptions($captions);
29 29
 		$this->captionCallback=NULL;
30
-		$this->defaultValueFunction=function($name,$value){return $value;};
30
+		$this->defaultValueFunction=function($name, $value) {return $value; };
31 31
 	}
32 32
 
33
-	public function moveFieldTo($from,$to){
34
-		if(JArray::moveElementTo($this->visibleProperties, $from, $to)){
33
+	public function moveFieldTo($from, $to) {
34
+		if (JArray::moveElementTo($this->visibleProperties, $from, $to)) {
35 35
 			return JArray::moveElementTo($this->values, $from, $to);
36 36
 		}
37 37
 		return false;
38 38
 	}
39 39
 
40
-	public function swapFields($index1,$index2){
41
-		if(JArray::swapElements($this->visibleProperties, $index1, $index2)){
40
+	public function swapFields($index1, $index2) {
41
+		if (JArray::swapElements($this->visibleProperties, $index1, $index2)) {
42 42
 			return JArray::swapElements($this->values, $index1, $index2);
43 43
 		}
44 44
 		return false;
45 45
 	}
46 46
 
47
-	public function removeField($index){
48
-		\array_splice($this->visibleProperties,$index,1);
49
-		\array_splice($this->values,$index,1);
50
-		\array_splice($this->captions,$index,1);
47
+	public function removeField($index) {
48
+		\array_splice($this->visibleProperties, $index, 1);
49
+		\array_splice($this->values, $index, 1);
50
+		\array_splice($this->captions, $index, 1);
51 51
 		return $this;
52 52
 	}
53 53
 
54
-	public function getValues(){
54
+	public function getValues() {
55 55
 		$values=[];
56 56
 		$index=0;
57 57
 		$count=$this->count();
58
-		while($index<$count){
58
+		while ($index<$count) {
59 59
 			$values[]=$this->getValue($index++);
60 60
 		}
61 61
 		return $values;
62 62
 	}
63 63
 
64
-	public function getIdentifier($index=NULL){
65
-		if(!isset($index))
64
+	public function getIdentifier($index=NULL) {
65
+		if (!isset($index))
66 66
 			$index=self::$index;
67 67
 		$value=$index;
68
-		if(isset($this->values["identifier"])){
69
-			if(\is_string($this->values["identifier"]))
68
+		if (isset($this->values["identifier"])) {
69
+			if (\is_string($this->values["identifier"]))
70 70
 				$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
71 71
 			else
72
-				$value=$this->values["identifier"]($index,$this->instance);
72
+				$value=$this->values["identifier"]($index, $this->instance);
73 73
 		}
74 74
 		return $value;
75 75
 	}
76 76
 
77
-	public function getValue($index){
77
+	public function getValue($index) {
78 78
 		$property=$this->properties[$index];
79 79
 		return $this->_getValue($property, $index);
80 80
 	}
81 81
 
82
-	protected function _beforeAddProperty($index,&$field){
82
+	protected function _beforeAddProperty($index, &$field) {
83 83
 
84 84
 	}
85 85
 
86
-	protected function _getDefaultValue($name,$value,$index){
86
+	protected function _getDefaultValue($name, $value, $index) {
87 87
 		$func=$this->defaultValueFunction;
88
-		return $func($name,$value,$index,$this->instance);
88
+		return $func($name, $value, $index, $this->instance);
89 89
 	}
90 90
 
91
-	protected function _getPropertyValue(\ReflectionProperty $property,$index){
91
+	protected function _getPropertyValue(\ReflectionProperty $property, $index) {
92 92
 		$property->setAccessible(true);
93 93
 		return $property->getValue($this->instance);
94 94
 	}
95 95
 
96
-	protected function _getValue($property,$index){
96
+	protected function _getValue($property, $index) {
97 97
 		$value=null;
98 98
 		$propertyName=$property;
99
-		if($property instanceof \ReflectionProperty){
99
+		if ($property instanceof \ReflectionProperty) {
100 100
 			$value=$this->_getPropertyValue($property, $index);
101 101
 			$propertyName=$property->getName();
102
-		}elseif(\is_callable($property))
102
+		}elseif (\is_callable($property))
103 103
 			$value=$property($this->instance);
104
-		elseif(\is_array($property)){
105
-			$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
104
+		elseif (\is_array($property)) {
105
+			$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index); }, $property);
106 106
 			$value=\implode("", $values);
107
-		}elseif(\is_string($property)){
107
+		}elseif (\is_string($property)) {
108 108
 			$value=$property;
109
-			if(isset($this->instance->{$property})){
109
+			if (isset($this->instance->{$property})) {
110 110
 				$value=$this->instance->{$property};
111
-			}elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
111
+			}elseif (\method_exists($this->instance, $getter=JReflection::getterName($property))) {
112 112
 				$value=JReflection::callMethod($this->instance, $getter, []);
113 113
 			}
114 114
 		}
115 115
 		return $this->_postGetValue($index, $propertyName, $value);
116 116
 	}
117 117
 
118
-	protected function _postGetValue($index,$propertyName,$value){
119
-		if(isset($this->values[$index])){
120
-			$value= $this->values[$index]($value,$this->instance,$index);
121
-		}else{
122
-			$value=$this->_getDefaultValue($propertyName,$value, $index);
118
+	protected function _postGetValue($index, $propertyName, $value) {
119
+		if (isset($this->values[$index])) {
120
+			$value=$this->values[$index]($value, $this->instance, $index);
121
+		} else {
122
+			$value=$this->_getDefaultValue($propertyName, $value, $index);
123 123
 		}
124
-		if(isset($this->afterCompile[$index])){
125
-			if(\is_callable($this->afterCompile[$index])){
126
-				$this->afterCompile[$index]($value,$this->instance,$index);
124
+		if (isset($this->afterCompile[$index])) {
125
+			if (\is_callable($this->afterCompile[$index])) {
126
+				$this->afterCompile[$index]($value, $this->instance, $index);
127 127
 			}
128 128
 		}
129 129
 		return $value;
130 130
 	}
131 131
 
132
-	public function insertField($index,$field){
133
-		array_splice( $this->visibleProperties, $index, 0, $field );
132
+	public function insertField($index, $field) {
133
+		array_splice($this->visibleProperties, $index, 0, $field);
134 134
 		return $this;
135 135
 	}
136 136
 
137
-	public function insertInField($index,$field){
137
+	public function insertInField($index, $field) {
138 138
 		$vb=$this->visibleProperties;
139
-		if(isset($vb[$index])){
140
-			if(\is_array($vb[$index])){
139
+		if (isset($vb[$index])) {
140
+			if (\is_array($vb[$index])) {
141 141
 				$this->visibleProperties[$index][]=$field;
142
-			}else{
143
-				$this->visibleProperties[$index]=[$vb[$index],$field];
142
+			} else {
143
+				$this->visibleProperties[$index]=[$vb[$index], $field];
144 144
 			}
145
-		}else{
145
+		} else {
146 146
 			return $this->insertField($index, $field);
147 147
 		}
148 148
 		return $this;
149 149
 	}
150 150
 
151
-	public function addField($field){
151
+	public function addField($field) {
152 152
 		$this->visibleProperties[]=$field;
153 153
 		return $this;
154 154
 	}
155 155
 
156
-	public function count(){
156
+	public function count() {
157 157
 		return \sizeof($this->properties);
158 158
 	}
159 159
 
160
-	public function visiblePropertiesCount(){
160
+	public function visiblePropertiesCount() {
161 161
 		return \sizeof($this->visibleProperties);
162 162
 	}
163 163
 
164
-	public function getProperty($index){
164
+	public function getProperty($index) {
165 165
 		return $this->properties[$index];
166 166
 	}
167 167
 
168
-	public function getFieldName($index){
168
+	public function getFieldName($index) {
169 169
 		$property=$this->getProperty($index);
170
-		if($property instanceof \ReflectionProperty){
170
+		if ($property instanceof \ReflectionProperty) {
171 171
 			$result=$property->getName();
172
-		}elseif(\is_callable($property)){
172
+		}elseif (\is_callable($property)) {
173 173
 			$result=$this->visibleProperties[$index];
174
-		}else{
174
+		} else {
175 175
 			$result=$property;
176 176
 		}
177 177
 		return $result;
178 178
 	}
179 179
 
180 180
 
181
-	protected function showableProperty(\ReflectionProperty $rProperty){
182
-		return JString::startswith($rProperty->getName(),"_")===false;
181
+	protected function showableProperty(\ReflectionProperty $rProperty) {
182
+		return JString::startswith($rProperty->getName(), "_")===false;
183 183
 	}
184 184
 
185 185
 	public function setInstance($instance) {
186
-		if(\is_string($instance)){
186
+		if (\is_string($instance)) {
187 187
 			$instance=new $instance();
188 188
 		}
189 189
 		$this->instance=$instance;
190 190
 		$this->properties=[];
191 191
 		$this->reflect=new \ReflectionClass($instance);
192
-		if(\sizeof($this->visibleProperties)===0){
192
+		if (\sizeof($this->visibleProperties)===0) {
193 193
 			$this->properties=$this->getDefaultProperties();
194
-		}else{
195
-			foreach ($this->visibleProperties as $property){
194
+		} else {
195
+			foreach ($this->visibleProperties as $property) {
196 196
 				$this->setInstanceProperty($property);
197 197
 			}
198 198
 		}
199 199
 		return $this;
200 200
 	}
201 201
 
202
-	private function setInstanceProperty($property){
203
-		if(\is_callable($property)){
202
+	private function setInstanceProperty($property) {
203
+		if (\is_callable($property)) {
204 204
 			$this->properties[]=$property;
205
-		}elseif(\is_string($property)){
206
-			try{
205
+		}elseif (\is_string($property)) {
206
+			try {
207 207
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
208 208
 				$rProperty=$this->reflect->getProperty($property);
209 209
 				$this->properties[]=$rProperty;
210
-			}catch(\Exception $e){
210
+			}catch (\Exception $e) {
211 211
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
212 212
 				$this->properties[]=$property;
213 213
 			}
214
-		}elseif(\is_int($property)){
214
+		}elseif (\is_int($property)) {
215 215
 			$props=$this->getDefaultProperties();
216
-			if(isset($props[$property]))
216
+			if (isset($props[$property]))
217 217
 				$this->properties[]=$props[$property];
218 218
 				else
219 219
 					$this->properties[]=$property;
220
-		}else{
220
+		} else {
221 221
 			$this->properties[]=$property;
222 222
 		}
223 223
 	}
224 224
 
225
-	protected function getDefaultProperties(){
225
+	protected function getDefaultProperties() {
226 226
 		$result=[];
227 227
 		$properties=$this->reflect->getProperties();
228
-		foreach ($properties as $property){
228
+		foreach ($properties as $property) {
229 229
 			$showable=$this->showableProperty($property);
230
-			if($showable!==false){
230
+			if ($showable!==false) {
231 231
 				$result[]=$property;
232 232
 			}
233 233
 		}
@@ -239,12 +239,12 @@  discard block
 block discarded – undo
239 239
 		return $this;
240 240
 	}
241 241
 
242
-	public function setValueFunction($index,$callback){
242
+	public function setValueFunction($index, $callback) {
243 243
 		$this->values[$index]=$callback;
244 244
 		return $this;
245 245
 	}
246 246
 
247
-	public function setIdentifierFunction($callback){
247
+	public function setIdentifierFunction($callback) {
248 248
 		$this->values["identifier"]=$callback;
249 249
 		return $this;
250 250
 	}
@@ -257,42 +257,42 @@  discard block
 block discarded – undo
257 257
 		return $this->properties;
258 258
 	}
259 259
 
260
-	public function getCaption($index){
261
-		if(isset($this->captions[$index])){
260
+	public function getCaption($index) {
261
+		if (isset($this->captions[$index])) {
262 262
 			return $this->captions[$index];
263 263
 		}
264
-		if($this->properties[$index] instanceof \ReflectionProperty)
264
+		if ($this->properties[$index] instanceof \ReflectionProperty)
265 265
 			return $this->properties[$index]->getName();
266
-		elseif(\is_callable($this->properties[$index]))
266
+		elseif (\is_callable($this->properties[$index]))
267 267
 			return "";
268 268
 		else
269 269
 			return $this->properties[$index];
270 270
 	}
271 271
 
272
-	public function getCaptions(){
272
+	public function getCaptions() {
273 273
 		$count=$this->count();
274
-		if(isset($this->captions)){
275
-			$captions= \array_values($this->captions);
274
+		if (isset($this->captions)) {
275
+			$captions=\array_values($this->captions);
276 276
 			$captionsSize=\sizeof($captions);
277
-			for($i=$captionsSize;$i<$count;$i++){
277
+			for ($i=$captionsSize; $i<$count; $i++) {
278 278
 				$captions[]="";
279 279
 			}
280
-		}else{
280
+		} else {
281 281
 			$captions=[];
282 282
 			$index=0;
283
-			while($index<$count){
283
+			while ($index<$count) {
284 284
 				$captions[]=$this->getCaption($index++);
285 285
 			}
286 286
 		}
287
-		if(isset($this->captionCallback) && \is_callable($this->captionCallback)){
287
+		if (isset($this->captionCallback) && \is_callable($this->captionCallback)) {
288 288
 			$callback=$this->captionCallback;
289
-			$callback($captions,$this->instance);
289
+			$callback($captions, $this->instance);
290 290
 		}
291 291
 		return $captions;
292 292
 	}
293 293
 
294
-	public function setCaption($index,$caption){
295
-		if(isset($this->captions)===false)
294
+	public function setCaption($index, $caption) {
295
+		if (isset($this->captions)===false)
296 296
 			$this->captions=[];
297 297
 		$this->captions[$index]=$caption;
298 298
 		return $this;
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * @param callable $callback function called after the field compilation
311 311
 	 * @return \Ajax\semantic\widgets\datatable\InstanceViewer
312 312
 	 */
313
-	public function afterCompile($index,$callback){
313
+	public function afterCompile($index, $callback) {
314 314
 		$this->afterCompile[$index]=$callback;
315 315
 		return $this;
316 316
 	}
Please login to merge, or discard this patch.
Braces   +42 added lines, -36 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
 		$this->widgetIdentifier=$identifier;
24 24
 		$this->values=[];
25 25
 		$this->afterCompile=[];
26
-		if(isset($instance))
27
-			$this->setInstance($instance);
26
+		if(isset($instance)) {
27
+					$this->setInstance($instance);
28
+		}
28 29
 		$this->setCaptions($captions);
29 30
 		$this->captionCallback=NULL;
30 31
 		$this->defaultValueFunction=function($name,$value){return $value;};
@@ -62,14 +63,16 @@  discard block
 block discarded – undo
62 63
 	}
63 64
 
64 65
 	public function getIdentifier($index=NULL){
65
-		if(!isset($index))
66
-			$index=self::$index;
66
+		if(!isset($index)) {
67
+					$index=self::$index;
68
+		}
67 69
 		$value=$index;
68 70
 		if(isset($this->values["identifier"])){
69
-			if(\is_string($this->values["identifier"]))
70
-				$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
71
-			else
72
-				$value=$this->values["identifier"]($index,$this->instance);
71
+			if(\is_string($this->values["identifier"])) {
72
+							$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
73
+			} else {
74
+							$value=$this->values["identifier"]($index,$this->instance);
75
+			}
73 76
 		}
74 77
 		return $value;
75 78
 	}
@@ -99,16 +102,16 @@  discard block
 block discarded – undo
99 102
 		if($property instanceof \ReflectionProperty){
100 103
 			$value=$this->_getPropertyValue($property, $index);
101 104
 			$propertyName=$property->getName();
102
-		}elseif(\is_callable($property))
103
-			$value=$property($this->instance);
104
-		elseif(\is_array($property)){
105
+		} elseif(\is_callable($property)) {
106
+					$value=$property($this->instance);
107
+		} elseif(\is_array($property)){
105 108
 			$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
106 109
 			$value=\implode("", $values);
107
-		}elseif(\is_string($property)){
110
+		} elseif(\is_string($property)){
108 111
 			$value=$property;
109 112
 			if(isset($this->instance->{$property})){
110 113
 				$value=$this->instance->{$property};
111
-			}elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
114
+			} elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
112 115
 				$value=JReflection::callMethod($this->instance, $getter, []);
113 116
 			}
114 117
 		}
@@ -118,7 +121,7 @@  discard block
 block discarded – undo
118 121
 	protected function _postGetValue($index,$propertyName,$value){
119 122
 		if(isset($this->values[$index])){
120 123
 			$value= $this->values[$index]($value,$this->instance,$index);
121
-		}else{
124
+		} else{
122 125
 			$value=$this->_getDefaultValue($propertyName,$value, $index);
123 126
 		}
124 127
 		if(isset($this->afterCompile[$index])){
@@ -139,10 +142,10 @@  discard block
 block discarded – undo
139 142
 		if(isset($vb[$index])){
140 143
 			if(\is_array($vb[$index])){
141 144
 				$this->visibleProperties[$index][]=$field;
142
-			}else{
145
+			} else{
143 146
 				$this->visibleProperties[$index]=[$vb[$index],$field];
144 147
 			}
145
-		}else{
148
+		} else{
146 149
 			return $this->insertField($index, $field);
147 150
 		}
148 151
 		return $this;
@@ -169,9 +172,9 @@  discard block
 block discarded – undo
169 172
 		$property=$this->getProperty($index);
170 173
 		if($property instanceof \ReflectionProperty){
171 174
 			$result=$property->getName();
172
-		}elseif(\is_callable($property)){
175
+		} elseif(\is_callable($property)){
173 176
 			$result=$this->visibleProperties[$index];
174
-		}else{
177
+		} else{
175 178
 			$result=$property;
176 179
 		}
177 180
 		return $result;
@@ -191,7 +194,7 @@  discard block
 block discarded – undo
191 194
 		$this->reflect=new \ReflectionClass($instance);
192 195
 		if(\sizeof($this->visibleProperties)===0){
193 196
 			$this->properties=$this->getDefaultProperties();
194
-		}else{
197
+		} else{
195 198
 			foreach ($this->visibleProperties as $property){
196 199
 				$this->setInstanceProperty($property);
197 200
 			}
@@ -202,22 +205,23 @@  discard block
 block discarded – undo
202 205
 	private function setInstanceProperty($property){
203 206
 		if(\is_callable($property)){
204 207
 			$this->properties[]=$property;
205
-		}elseif(\is_string($property)){
208
+		} elseif(\is_string($property)){
206 209
 			try{
207 210
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
208 211
 				$rProperty=$this->reflect->getProperty($property);
209 212
 				$this->properties[]=$rProperty;
210
-			}catch(\Exception $e){
213
+			} catch(\Exception $e){
211 214
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
212 215
 				$this->properties[]=$property;
213 216
 			}
214
-		}elseif(\is_int($property)){
217
+		} elseif(\is_int($property)){
215 218
 			$props=$this->getDefaultProperties();
216
-			if(isset($props[$property]))
217
-				$this->properties[]=$props[$property];
218
-				else
219
-					$this->properties[]=$property;
220
-		}else{
219
+			if(isset($props[$property])) {
220
+							$this->properties[]=$props[$property];
221
+			} else {
222
+									$this->properties[]=$property;
223
+				}
224
+		} else{
221 225
 			$this->properties[]=$property;
222 226
 		}
223 227
 	}
@@ -261,12 +265,13 @@  discard block
 block discarded – undo
261 265
 		if(isset($this->captions[$index])){
262 266
 			return $this->captions[$index];
263 267
 		}
264
-		if($this->properties[$index] instanceof \ReflectionProperty)
265
-			return $this->properties[$index]->getName();
266
-		elseif(\is_callable($this->properties[$index]))
267
-			return "";
268
-		else
269
-			return $this->properties[$index];
268
+		if($this->properties[$index] instanceof \ReflectionProperty) {
269
+					return $this->properties[$index]->getName();
270
+		} elseif(\is_callable($this->properties[$index])) {
271
+					return "";
272
+		} else {
273
+					return $this->properties[$index];
274
+		}
270 275
 	}
271 276
 
272 277
 	public function getCaptions(){
@@ -277,7 +282,7 @@  discard block
 block discarded – undo
277 282
 			for($i=$captionsSize;$i<$count;$i++){
278 283
 				$captions[]="";
279 284
 			}
280
-		}else{
285
+		} else{
281 286
 			$captions=[];
282 287
 			$index=0;
283 288
 			while($index<$count){
@@ -292,8 +297,9 @@  discard block
 block discarded – undo
292 297
 	}
293 298
 
294 299
 	public function setCaption($index,$caption){
295
-		if(isset($this->captions)===false)
296
-			$this->captions=[];
300
+		if(isset($this->captions)===false) {
301
+					$this->captions=[];
302
+		}
297 303
 		$this->captions[$index]=$caption;
298 304
 		return $this;
299 305
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/FormInstanceViewer.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -11,58 +11,58 @@  discard block
 block discarded – undo
11 11
 	protected $headers;
12 12
 	protected $wrappers;
13 13
 
14
-	public function __construct($identifier,$instance=NULL, $captions=NULL) {
15
-		parent::__construct($identifier,$instance, $captions);
14
+	public function __construct($identifier, $instance=NULL, $captions=NULL) {
15
+		parent::__construct($identifier, $instance, $captions);
16 16
 		$this->separators=[-1];
17 17
 		$this->headers=[];
18 18
 		$this->wrappers=[];
19
-		$this->defaultValueFunction=function($name,$value,$index){
19
+		$this->defaultValueFunction=function($name, $value, $index) {
20 20
 			$caption=$this->getCaption($index);
21
-			$input=new HtmlFormInput($this->widgetIdentifier."-".$name,$caption,"text",$value);
21
+			$input=new HtmlFormInput($this->widgetIdentifier."-".$name, $caption, "text", $value);
22 22
 			$input->setName($name);
23 23
 			return $input;
24 24
 		};
25 25
 	}
26 26
 
27
-	protected function _beforeAddProperty($index,&$field){
28
-		if(JString::endswith($field, "\n")===true){
27
+	protected function _beforeAddProperty($index, &$field) {
28
+		if (JString::endswith($field, "\n")===true) {
29 29
 			$this->addSeparatorAfter($index);
30 30
 		}
31
-		if($index>1 && JString::startswith($field, "\n")===true){
31
+		if ($index>1 && JString::startswith($field, "\n")===true) {
32 32
 			$this->addSeparatorAfter($index-1);
33 33
 		}
34 34
 		$field=\str_replace("\n", "", $field);
35
-		if(($header=$this->hasHeader($field))!==false){
35
+		if (($header=$this->hasHeader($field))!==false) {
36 36
 			$this->addHeaderDividerBefore($index, $header);
37 37
 		}
38 38
 	}
39 39
 
40
-	protected function hasHeader(&$field){
41
-		$matches=[];$result=false;
42
-		if(\preg_match('/\{(.*?)\}/s', $field, $matches)===1){
40
+	protected function hasHeader(&$field) {
41
+		$matches=[]; $result=false;
42
+		if (\preg_match('/\{(.*?)\}/s', $field, $matches)===1) {
43 43
 			$result=$matches[1];
44
-			$field=\str_replace("{".$result."}","", $field);
44
+			$field=\str_replace("{".$result."}", "", $field);
45 45
 		}
46 46
 		return $result;
47 47
 	}
48 48
 
49 49
 
50 50
 
51
-	public function addSeparatorAfter($fieldNum){
52
-		if(\array_search($fieldNum, $this->separators)===false)
51
+	public function addSeparatorAfter($fieldNum) {
52
+		if (\array_search($fieldNum, $this->separators)===false)
53 53
 			$this->separators[]=$fieldNum;
54 54
 		return $this;
55 55
 	}
56 56
 
57
-	public function addHeaderDividerBefore($fieldNum,$header){
57
+	public function addHeaderDividerBefore($fieldNum, $header) {
58 58
 		$this->headers[$fieldNum]=$header;
59
-		if($fieldNum>0)
59
+		if ($fieldNum>0)
60 60
 			$this->addSeparatorAfter($fieldNum-1);
61 61
 		return $this;
62 62
 	}
63 63
 
64
-	public function addWrapper($fieldNum,$contentBefore,$contentAfter=null){
65
-		$this->wrappers[$fieldNum]=[$contentBefore,$contentAfter];
64
+	public function addWrapper($fieldNum, $contentBefore, $contentAfter=null) {
65
+		$this->wrappers[$fieldNum]=[$contentBefore, $contentAfter];
66 66
 			return $this;
67 67
 	}
68 68
 
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
 		return $this->separators;
71 71
 	}
72 72
 
73
-	public function removeSeparator($index){
74
-		\array_splice($this->separators,$index,1);
73
+	public function removeSeparator($index) {
74
+		\array_splice($this->separators, $index, 1);
75 75
 	}
76 76
 
77
-	public function removeField($index){
77
+	public function removeField($index) {
78 78
 		parent::removeField($index);
79 79
 		$pos=\array_search($index, $this->separators);
80
-		if($pos!==false){
80
+		if ($pos!==false) {
81 81
 			$sepCount=\sizeof($this->separators);
82
-			for($i=$pos+1;$i<$sepCount;$i++){
82
+			for ($i=$pos+1; $i<$sepCount; $i++) {
83 83
 				$this->separators[$i]--;
84 84
 			}
85 85
 			\array_splice($this->separators, $pos, 1);
Please login to merge, or discard this patch.
Ajax/semantic/components/Popup.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 	 * @return $this
28 28
 	 */
29 29
 	public function setOnShow($jsCode) {
30
-		$jsCode=str_ireplace("\"","%quote%", $jsCode);
30
+		$jsCode=str_ireplace("\"", "%quote%", $jsCode);
31 31
 		return $this->setParam("onShow", "%function(){".$jsCode."}%");
32 32
 	}
33 33
 
34
-	public function setExclusive($value){
34
+	public function setExclusive($value) {
35 35
 		return $this->setParam("exclusive", $value);
36 36
 	}
37 37
 
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 	 * @param string $popup the css selector of the popup
41 41
 	 * @return \Ajax\semantic\components\Popup
42 42
 	 */
43
-	public function setPopup($popup){
43
+	public function setPopup($popup) {
44 44
 		return $this->setParam("popup", $popup);
45 45
 	}
46 46
 
47
-	public function setInline($value){
47
+	public function setInline($value) {
48 48
 		return $this->setParam("inline", $value);
49 49
 	}
50 50
 
51
-	public function setPosition($value){
51
+	public function setPosition($value) {
52 52
 		return $this->setParam("position", $value);
53 53
 	}
54 54
 }
Please login to merge, or discard this patch.
Ajax/semantic/components/Sticky.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 		return $this->setParam("context", $value);
22 22
 	}
23 23
 
24
-	public function setOffset($offset=0){
24
+	public function setOffset($offset=0) {
25 25
 		return $this->setParam("offset", $offset);
26 26
 	}
27 27
 }
Please login to merge, or discard this patch.
Ajax/semantic/components/Checkbox.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 		$this->params["onUnchecked"]="%function(){".$value."}%";
21 21
 	}
22 22
 
23
-	public function setOnChange($value){
23
+	public function setOnChange($value) {
24 24
 		$this->params["onChange"]="%function(){".$value."}%";
25 25
 	}
26 26
 }
Please login to merge, or discard this patch.