Completed
Push — scrutinizer ( c2ef4a )
by Fabio
21:50
created
framework/Web/UI/WebControls/TListControlValidator.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -164,6 +164,7 @@
 block discarded – undo
164 164
 
165 165
 	/**
166 166
 	 * @param TListControl control to validate
167
+	 * @param TControl $control
167 168
 	 * @return array number of selected values and its values.
168 169
 	 */
169 170
 	protected function getSelection($control)
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function getMinSelection()
78 78
 	{
79
-		return $this->getViewState('MinSelection',-1);
79
+		return $this->getViewState('MinSelection', -1);
80 80
 	}
81 81
 
82 82
 	/**
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function setMinSelection($value)
86 86
 	{
87
-		if(($value=TPropertyValue::ensureInteger($value))<0)
88
-			$value=-1;
89
-		$this->setViewState('MinSelection',$value,-1);
87
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
88
+			$value = -1;
89
+		$this->setViewState('MinSelection', $value, -1);
90 90
 	}
91 91
 
92 92
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function getMaxSelection()
96 96
 	{
97
-		return $this->getViewState('MaxSelection',-1);
97
+		return $this->getViewState('MaxSelection', -1);
98 98
 	}
99 99
 
100 100
 	/**
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function setMaxSelection($value)
104 104
 	{
105
-		if(($value=TPropertyValue::ensureInteger($value))<0)
106
-			$value=-1;
107
-		$this->setViewState('MaxSelection',$value,-1);
105
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
106
+			$value = -1;
107
+		$this->setViewState('MaxSelection', $value, -1);
108 108
 	}
109 109
 
110 110
 	/**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function getRequiredSelections()
115 115
 	{
116
-		return $this->getViewState('RequiredSelections','');
116
+		return $this->getViewState('RequiredSelections', '');
117 117
 	}
118 118
 
119 119
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function setRequiredSelections($value)
124 124
 	{
125
-		$this->setViewState('RequiredSelections',$value,'');
125
+		$this->setViewState('RequiredSelections', $value, '');
126 126
 	}
127 127
 
128 128
 	/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	protected function evaluateIsValid()
135 135
 	{
136
-		$control=$this->getValidationTarget();
136
+		$control = $this->getValidationTarget();
137 137
 
138 138
 		$exists = true;
139 139
 		$values = $this->getSelection($control);
@@ -141,22 +141,22 @@  discard block
 block discarded – undo
141 141
 		$required = $this->getRequiredValues();
142 142
 
143 143
 		//if required, check the values
144
-		if(!empty($required))
144
+		if (!empty($required))
145 145
 		{
146
-			if($count < count($required) )
146
+			if ($count < count($required))
147 147
 				return false;
148
-			foreach($required as $require)
148
+			foreach ($required as $require)
149 149
 				$exists = $exists && in_array($require, $values);
150 150
 		}
151 151
 
152 152
 		$min = $this->getMinSelection();
153 153
 		$max = $this->getMaxSelection();
154 154
 
155
-		if($min !== -1 && $max !== -1)
155
+		if ($min !== -1 && $max !== -1)
156 156
 			return $exists && $count >= $min && $count <= $max;
157
-		else if($min === -1 && $max !== -1)
157
+		else if ($min === -1 && $max !== -1)
158 158
 			return $exists && $count <= $max;
159
-		else if($min !== -1 && $max === -1)
159
+		else if ($min !== -1 && $max === -1)
160 160
 			return $exists && $count >= $min;
161 161
 		else
162 162
 			return $exists;
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 		$values = array();
172 172
 
173 173
 		//get the data
174
-		foreach($control->getItems() as $item)
174
+		foreach ($control->getItems() as $item)
175 175
 		{
176
-			if($item->getSelected())
176
+			if ($item->getSelected())
177 177
 				$values[] = $item->getValue();
178 178
 		}
179 179
 		return $values;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	{
187 187
 		$required = array();
188 188
 		$string = $this->getRequiredSelections();
189
-		if(!empty($string))
189
+		if (!empty($string))
190 190
 			$required = preg_split('/,\s*/', $string);
191 191
 		return $required;
192 192
 	}
@@ -200,22 +200,22 @@  discard block
 block discarded – undo
200 200
 		$options = parent::getClientScriptOptions();
201 201
 		$control = $this->getValidationTarget();
202 202
 
203
-		if(!$control instanceof TListControl)
203
+		if (!$control instanceof TListControl)
204 204
 		{
205 205
 			throw new TConfigurationException(
206 206
 				'listcontrolvalidator_invalid_control',
207
-				$this->getID(),$this->getControlToValidate(), get_class($control));
207
+				$this->getID(), $this->getControlToValidate(), get_class($control));
208 208
 		}
209 209
 
210 210
 		$min = $this->getMinSelection();
211 211
 		$max = $this->getMaxSelection();
212
-		if($min !== -1)
213
-			$options['Min']= $min;
214
-		if($max !== -1)
215
-			$options['Max']= $max;
212
+		if ($min !== -1)
213
+			$options['Min'] = $min;
214
+		if ($max !== -1)
215
+			$options['Max'] = $max;
216 216
 		$required = $this->getRequiredSelections();
217
-		if(strlen($required) > 0)
218
-			$options['Required']= $required;
217
+		if (strlen($required) > 0)
218
+			$options['Required'] = $required;
219 219
 		$options['TotalItems'] = $control->getItemCount();
220 220
 
221 221
 		return $options;
Please login to merge, or discard this patch.
Braces   +36 added lines, -26 removed lines patch added patch discarded remove patch
@@ -84,8 +84,9 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function setMinSelection($value)
86 86
 	{
87
-		if(($value=TPropertyValue::ensureInteger($value))<0)
88
-			$value=-1;
87
+		if(($value=TPropertyValue::ensureInteger($value))<0) {
88
+					$value=-1;
89
+		}
89 90
 		$this->setViewState('MinSelection',$value,-1);
90 91
 	}
91 92
 
@@ -102,8 +103,9 @@  discard block
 block discarded – undo
102 103
 	 */
103 104
 	public function setMaxSelection($value)
104 105
 	{
105
-		if(($value=TPropertyValue::ensureInteger($value))<0)
106
-			$value=-1;
106
+		if(($value=TPropertyValue::ensureInteger($value))<0) {
107
+					$value=-1;
108
+		}
107 109
 		$this->setViewState('MaxSelection',$value,-1);
108 110
 	}
109 111
 
@@ -143,23 +145,26 @@  discard block
 block discarded – undo
143 145
 		//if required, check the values
144 146
 		if(!empty($required))
145 147
 		{
146
-			if($count < count($required) )
147
-				return false;
148
-			foreach($required as $require)
149
-				$exists = $exists && in_array($require, $values);
148
+			if($count < count($required) ) {
149
+							return false;
150
+			}
151
+			foreach($required as $require) {
152
+							$exists = $exists && in_array($require, $values);
153
+			}
150 154
 		}
151 155
 
152 156
 		$min = $this->getMinSelection();
153 157
 		$max = $this->getMaxSelection();
154 158
 
155
-		if($min !== -1 && $max !== -1)
156
-			return $exists && $count >= $min && $count <= $max;
157
-		else if($min === -1 && $max !== -1)
158
-			return $exists && $count <= $max;
159
-		else if($min !== -1 && $max === -1)
160
-			return $exists && $count >= $min;
161
-		else
162
-			return $exists;
159
+		if($min !== -1 && $max !== -1) {
160
+					return $exists && $count >= $min && $count <= $max;
161
+		} else if($min === -1 && $max !== -1) {
162
+					return $exists && $count <= $max;
163
+		} else if($min !== -1 && $max === -1) {
164
+					return $exists && $count >= $min;
165
+		} else {
166
+					return $exists;
167
+		}
163 168
 	}
164 169
 
165 170
 	/**
@@ -173,8 +178,9 @@  discard block
 block discarded – undo
173 178
 		//get the data
174 179
 		foreach($control->getItems() as $item)
175 180
 		{
176
-			if($item->getSelected())
177
-				$values[] = $item->getValue();
181
+			if($item->getSelected()) {
182
+							$values[] = $item->getValue();
183
+			}
178 184
 		}
179 185
 		return $values;
180 186
 	}
@@ -186,8 +192,9 @@  discard block
 block discarded – undo
186 192
 	{
187 193
 		$required = array();
188 194
 		$string = $this->getRequiredSelections();
189
-		if(!empty($string))
190
-			$required = preg_split('/,\s*/', $string);
195
+		if(!empty($string)) {
196
+					$required = preg_split('/,\s*/', $string);
197
+		}
191 198
 		return $required;
192 199
 	}
193 200
 
@@ -209,13 +216,16 @@  discard block
 block discarded – undo
209 216
 
210 217
 		$min = $this->getMinSelection();
211 218
 		$max = $this->getMaxSelection();
212
-		if($min !== -1)
213
-			$options['Min']= $min;
214
-		if($max !== -1)
215
-			$options['Max']= $max;
219
+		if($min !== -1) {
220
+					$options['Min']= $min;
221
+		}
222
+		if($max !== -1) {
223
+					$options['Max']= $max;
224
+		}
216 225
 		$required = $this->getRequiredSelections();
217
-		if(strlen($required) > 0)
218
-			$options['Required']= $required;
226
+		if(strlen($required) > 0) {
227
+					$options['Required']= $required;
228
+		}
219 229
 		$options['TotalItems'] = $control->getItemCount();
220 230
 
221 231
 		return $options;
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TListItem.php 3 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -92,6 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 	/**
94 94
 	 * @param boolean whether the item is enabled
95
+	 * @param boolean $value
95 96
 	 */
96 97
 	public function setEnabled($value)
97 98
 	{
@@ -108,6 +109,7 @@  discard block
 block discarded – undo
108 109
 
109 110
 	/**
110 111
 	 * @param boolean whether the item is selected
112
+	 * @param boolean $value
111 113
 	 */
112 114
 	public function setSelected($value)
113 115
 	{
@@ -166,6 +168,7 @@  discard block
 block discarded – undo
166 168
 
167 169
 	/**
168 170
 	 * @param string name of the attribute
171
+	 * @param string $name
169 172
 	 * @return boolean whether the named attribute exists
170 173
 	 */
171 174
 	public function hasAttribute($name)
@@ -174,6 +177,7 @@  discard block
 block discarded – undo
174 177
 	}
175 178
 
176 179
 	/**
180
+	 * @param string $name
177 181
 	 * @return string the named attribute value, null if attribute does not exist
178 182
 	 */
179 183
 	public function getAttribute($name)
@@ -184,6 +188,7 @@  discard block
 block discarded – undo
184 188
 	/**
185 189
 	 * @param string attribute name
186 190
 	 * @param string value of the attribute
191
+	 * @param string $name
187 192
 	 */
188 193
 	public function setAttribute($name,$value)
189 194
 	{
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -28,23 +28,23 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @var TMap list of custom attributes
30 30
 	 */
31
-	private $_attributes=null;
31
+	private $_attributes = null;
32 32
 	/**
33 33
 	 * @var string text of the item
34 34
 	 */
35
-	private $_text='';
35
+	private $_text = '';
36 36
 	/**
37 37
 	 * @var string value of the item
38 38
 	 */
39
-	private $_value='';
39
+	private $_value = '';
40 40
 	/**
41 41
 	 * @var boolean whether the item is enabled
42 42
 	 */
43
-	private $_enabled=true;
43
+	private $_enabled = true;
44 44
 	/**
45 45
 	 * @var boolean whether the item is selected
46 46
 	 */
47
-	private $_selected=false;
47
+	private $_selected = false;
48 48
 
49 49
 	/**
50 50
 	 * Constructor.
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @param boolean whether the item is enabled
54 54
 	 * @param boolean whether the item is selected
55 55
 	 */
56
-	public function __construct($text='',$value='',$enabled=true,$selected=false)
56
+	public function __construct($text = '', $value = '', $enabled = true, $selected = false)
57 57
 	{
58 58
 		$this->setText($text);
59 59
 		$this->setValue($value);
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
 	protected function __getZappableSleepProps(&$exprops)
71 71
 	{
72 72
 		parent::__getZappableSleepProps($exprops);
73
-		if ($this->_attributes===null)
73
+		if ($this->_attributes === null)
74 74
 			$exprops[] = "\0TListItem\0_attributes";
75
-		if($this->_text==='')
75
+		if ($this->_text === '')
76 76
 			$exprops[] = "\0TListItem\0_text";
77
-		if($this->_value==='')
77
+		if ($this->_value === '')
78 78
 			$exprops[] = "\0TListItem\0_value";
79
-		if ($this->_enabled===true)
79
+		if ($this->_enabled === true)
80 80
 			$exprops[] = "\0TListItem\0_enabled";
81
-		if ($this->_selected===false)
81
+		if ($this->_selected === false)
82 82
 			$exprops[] = "\0TListItem\0_selected";
83 83
 	}
84 84
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function setEnabled($value)
97 97
 	{
98
-		$this->_enabled=TPropertyValue::ensureBoolean($value);
98
+		$this->_enabled = TPropertyValue::ensureBoolean($value);
99 99
 	}
100 100
 
101 101
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function setSelected($value)
113 113
 	{
114
-		$this->_selected=TPropertyValue::ensureBoolean($value);
114
+		$this->_selected = TPropertyValue::ensureBoolean($value);
115 115
 	}
116 116
 
117 117
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function getText()
121 121
 	{
122
-		return $this->_text===''?$this->_value:$this->_text;
122
+		return $this->_text === '' ? $this->_value : $this->_text;
123 123
 	}
124 124
 
125 125
 	/**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function setText($value)
129 129
 	{
130
-		$this->_text=TPropertyValue::ensureString($value);
130
+		$this->_text = TPropertyValue::ensureString($value);
131 131
 	}
132 132
 
133 133
 	/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function getValue()
137 137
 	{
138
-		return $this->_value===''?$this->_text:$this->_value;
138
+		return $this->_value === '' ? $this->_text : $this->_value;
139 139
 	}
140 140
 
141 141
 	/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public function setValue($value)
145 145
 	{
146
-		$this->_value=TPropertyValue::ensureString($value);
146
+		$this->_value = TPropertyValue::ensureString($value);
147 147
 	}
148 148
 
149 149
 	/**
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function getAttributes()
153 153
 	{
154
-		if(!$this->_attributes)
155
-			$this->_attributes=new TAttributeCollection;
154
+		if (!$this->_attributes)
155
+			$this->_attributes = new TAttributeCollection;
156 156
 		return $this->_attributes;
157 157
 	}
158 158
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	public function getHasAttributes()
163 163
 	{
164
-		return $this->_attributes && $this->_attributes->getCount()>0;
164
+		return $this->_attributes && $this->_attributes->getCount() > 0;
165 165
 	}
166 166
 
167 167
 	/**
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public function hasAttribute($name)
172 172
 	{
173
-		return $this->_attributes?$this->_attributes->contains($name):false;
173
+		return $this->_attributes ? $this->_attributes->contains($name) : false;
174 174
 	}
175 175
 
176 176
 	/**
@@ -178,16 +178,16 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public function getAttribute($name)
180 180
 	{
181
-		return $this->_attributes?$this->_attributes->itemAt($name):null;
181
+		return $this->_attributes ? $this->_attributes->itemAt($name) : null;
182 182
 	}
183 183
 
184 184
 	/**
185 185
 	 * @param string attribute name
186 186
 	 * @param string value of the attribute
187 187
 	 */
188
-	public function setAttribute($name,$value)
188
+	public function setAttribute($name, $value)
189 189
 	{
190
-		$this->getAttributes()->add($name,$value);
190
+		$this->getAttributes()->add($name, $value);
191 191
 	}
192 192
 
193 193
 	/**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public function removeAttribute($name)
199 199
 	{
200
-		return $this->_attributes?$this->_attributes->remove($name):null;
200
+		return $this->_attributes ? $this->_attributes->remove($name) : null;
201 201
 	}
202 202
 }
203 203
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -70,16 +70,21 @@  discard block
 block discarded – undo
70 70
 	protected function __getZappableSleepProps(&$exprops)
71 71
 	{
72 72
 		parent::__getZappableSleepProps($exprops);
73
-		if ($this->_attributes===null)
74
-			$exprops[] = "\0TListItem\0_attributes";
75
-		if($this->_text==='')
76
-			$exprops[] = "\0TListItem\0_text";
77
-		if($this->_value==='')
78
-			$exprops[] = "\0TListItem\0_value";
79
-		if ($this->_enabled===true)
80
-			$exprops[] = "\0TListItem\0_enabled";
81
-		if ($this->_selected===false)
82
-			$exprops[] = "\0TListItem\0_selected";
73
+		if ($this->_attributes===null) {
74
+					$exprops[] = "\0TListItem\0_attributes";
75
+		}
76
+		if($this->_text==='') {
77
+					$exprops[] = "\0TListItem\0_text";
78
+		}
79
+		if($this->_value==='') {
80
+					$exprops[] = "\0TListItem\0_value";
81
+		}
82
+		if ($this->_enabled===true) {
83
+					$exprops[] = "\0TListItem\0_enabled";
84
+		}
85
+		if ($this->_selected===false) {
86
+					$exprops[] = "\0TListItem\0_selected";
87
+		}
83 88
 	}
84 89
 
85 90
 	/**
@@ -151,8 +156,9 @@  discard block
 block discarded – undo
151 156
 	 */
152 157
 	public function getAttributes()
153 158
 	{
154
-		if(!$this->_attributes)
155
-			$this->_attributes=new TAttributeCollection;
159
+		if(!$this->_attributes) {
160
+					$this->_attributes=new TAttributeCollection;
161
+		}
156 162
 		return $this->_attributes;
157 163
 	}
158 164
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TMultiView.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -281,6 +281,7 @@
 block discarded – undo
281 281
 	 * controls be added into the collection.
282 282
 	 * @param integer the speicified position.
283 283
 	 * @param mixed new item
284
+	 * @param TWizardStep $item
284 285
 	 * @throws TInvalidDataTypeException if the item to be inserted is neither a string nor a TControl.
285 286
 	 */
286 287
 	public function insertAt($index,$item)
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
  */
37 37
 class TMultiView extends TControl
38 38
 {
39
-	const CMD_NEXTVIEW='NextView';
40
-	const CMD_PREVIOUSVIEW='PreviousView';
41
-	const CMD_SWITCHVIEWID='SwitchViewID';
42
-	const CMD_SWITCHVIEWINDEX='SwitchViewIndex';
43
-	private $_cachedActiveViewIndex=-1;
44
-	private $_ignoreBubbleEvents=false;
39
+	const CMD_NEXTVIEW = 'NextView';
40
+	const CMD_PREVIOUSVIEW = 'PreviousView';
41
+	const CMD_SWITCHVIEWID = 'SwitchViewID';
42
+	const CMD_SWITCHVIEWINDEX = 'SwitchViewIndex';
43
+	private $_cachedActiveViewIndex = -1;
44
+	private $_ignoreBubbleEvents = false;
45 45
 
46 46
 	/**
47 47
 	 * Processes an object that is created during parsing template.
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function addParsedObject($object)
55 55
 	{
56
-		if($object instanceof TView)
56
+		if ($object instanceof TView)
57 57
 			$this->getControls()->add($object);
58
-		else if(!is_string($object))
58
+		else if (!is_string($object))
59 59
 			throw new TConfigurationException('multiview_view_required');
60 60
 	}
61 61
 
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function getActiveViewIndex()
75 75
 	{
76
-		if($this->_cachedActiveViewIndex>-1)
76
+		if ($this->_cachedActiveViewIndex > -1)
77 77
 			return $this->_cachedActiveViewIndex;
78 78
 		else
79
-			return $this->getControlState('ActiveViewIndex',-1);
79
+			return $this->getControlState('ActiveViewIndex', -1);
80 80
 	}
81 81
 
82 82
 	/**
@@ -85,21 +85,21 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function setActiveViewIndex($value)
87 87
 	{
88
-		if(($index=TPropertyValue::ensureInteger($value))<0)
89
-			$index=-1;
90
-		$views=$this->getViews();
91
-		$count=$views->getCount();
92
-		if($count===0 && $this->getControlStage()<TControl::CS_CHILD_INITIALIZED)
93
-			$this->_cachedActiveViewIndex=$index;
94
-		else if($index<$count)
88
+		if (($index = TPropertyValue::ensureInteger($value)) < 0)
89
+			$index = -1;
90
+		$views = $this->getViews();
91
+		$count = $views->getCount();
92
+		if ($count === 0 && $this->getControlStage() < TControl::CS_CHILD_INITIALIZED)
93
+			$this->_cachedActiveViewIndex = $index;
94
+		else if ($index < $count)
95 95
 		{
96
-			$this->setControlState('ActiveViewIndex',$index,-1);
97
-			$this->_cachedActiveViewIndex=-1;
98
-			if($index>=0)
99
-				$this->activateView($views->itemAt($index),true);
96
+			$this->setControlState('ActiveViewIndex', $index, -1);
97
+			$this->_cachedActiveViewIndex = -1;
98
+			if ($index >= 0)
99
+				$this->activateView($views->itemAt($index), true);
100 100
 		}
101 101
 		else
102
-			throw new TInvalidDataValueException('multiview_activeviewindex_invalid',$index);
102
+			throw new TInvalidDataValueException('multiview_activeviewindex_invalid', $index);
103 103
 	}
104 104
 
105 105
 	/**
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function getActiveView()
110 110
 	{
111
-		$index=$this->getActiveViewIndex();
112
-		$views=$this->getViews();
113
-		if($index>=$views->getCount())
114
-			throw new TInvalidDataValueException('multiview_activeviewindex_invalid',$index);
115
-		if($index<0)
111
+		$index = $this->getActiveViewIndex();
112
+		$views = $this->getViews();
113
+		if ($index >= $views->getCount())
114
+			throw new TInvalidDataValueException('multiview_activeviewindex_invalid', $index);
115
+		if ($index < 0)
116 116
 			return null;
117
-		$view=$views->itemAt($index);
118
-		if(!$view->getActive())
119
-			$this->activateView($view,false);
117
+		$view = $views->itemAt($index);
118
+		if (!$view->getActive())
119
+			$this->activateView($view, false);
120 120
 		return $view;
121 121
 	}
122 122
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public function setActiveView($view)
128 128
 	{
129
-		if(($index=$this->getViews()->indexOf($view))>=0)
129
+		if (($index = $this->getViews()->indexOf($view)) >= 0)
130 130
 			$this->setActiveViewIndex($index);
131 131
 		else
132 132
 			throw new TInvalidOperationException('multiview_view_inexistent');
@@ -138,26 +138,26 @@  discard block
 block discarded – undo
138 138
 	 * @param TView the view to be activated
139 139
 	 * @param boolean whether to trigger OnActiveViewChanged event.
140 140
 	 */
141
-	protected function activateView($view,$triggerViewChangedEvent=true)
141
+	protected function activateView($view, $triggerViewChangedEvent = true)
142 142
 	{
143
-		if($view->getActive())
143
+		if ($view->getActive())
144 144
 			return;
145
-		$triggerEvent=$triggerViewChangedEvent && ($this->getControlStage()>=TControl::CS_STATE_LOADED || ($this->getPage() && !$this->getPage()->getIsPostBack()));
146
-		foreach($this->getViews() as $v)
145
+		$triggerEvent = $triggerViewChangedEvent && ($this->getControlStage() >= TControl::CS_STATE_LOADED || ($this->getPage() && !$this->getPage()->getIsPostBack()));
146
+		foreach ($this->getViews() as $v)
147 147
 		{
148
-			if($v===$view)
148
+			if ($v === $view)
149 149
 			{
150 150
 				$view->setActive(true);
151
-				if($triggerEvent)
151
+				if ($triggerEvent)
152 152
 				{
153 153
 					$view->onActivate(null);
154 154
 					$this->onActiveViewChanged(null);
155 155
 				}
156 156
 			}
157
-			else if($v->getActive())
157
+			else if ($v->getActive())
158 158
 			{
159 159
 				$v->setActive(false);
160
-				if($triggerEvent)
160
+				if ($triggerEvent)
161 161
 					$v->onDeactivate(null);
162 162
 			}
163 163
 		}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public function ignoreBubbleEvents()
180 180
 	{
181
-		$this->_ignoreBubbleEvents=true;
181
+		$this->_ignoreBubbleEvents = true;
182 182
 	}
183 183
 
184 184
 	/**
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	public function onInit($param)
190 190
 	{
191 191
 		parent::onInit($param);
192
-		if($this->_cachedActiveViewIndex>=0)
192
+		if ($this->_cachedActiveViewIndex >= 0)
193 193
 			$this->setActiveViewIndex($this->_cachedActiveViewIndex);
194 194
 	}
195 195
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	public function onActiveViewChanged($param)
202 202
 	{
203
-		$this->raiseEvent('OnActiveViewChanged',$this,$param);
203
+		$this->raiseEvent('OnActiveViewChanged', $this, $param);
204 204
 	}
205 205
 
206 206
 	/**
@@ -210,25 +210,25 @@  discard block
 block discarded – undo
210 210
 	 * @param mixed event parameter
211 211
 	 * @return boolean whether this event is handled
212 212
 	 */
213
-	public function bubbleEvent($sender,$param)
213
+	public function bubbleEvent($sender, $param)
214 214
 	{
215
-		if(!$this->_ignoreBubbleEvents && ($param instanceof TCommandEventParameter))
215
+		if (!$this->_ignoreBubbleEvents && ($param instanceof TCommandEventParameter))
216 216
 		{
217
-			switch($param->getCommandName())
217
+			switch ($param->getCommandName())
218 218
 			{
219 219
 				case self::CMD_NEXTVIEW:
220
-					if(($index=$this->getActiveViewIndex())<$this->getViews()->getCount()-1)
221
-						$this->setActiveViewIndex($index+1);
220
+					if (($index = $this->getActiveViewIndex()) < $this->getViews()->getCount() - 1)
221
+						$this->setActiveViewIndex($index + 1);
222 222
 					else
223 223
 						$this->setActiveViewIndex(-1);
224 224
 					return true;
225 225
 				case self::CMD_PREVIOUSVIEW:
226
-					if(($index=$this->getActiveViewIndex())>=0)
227
-						$this->setActiveViewIndex($index-1);
226
+					if (($index = $this->getActiveViewIndex()) >= 0)
227
+						$this->setActiveViewIndex($index - 1);
228 228
 					return true;
229 229
 				case self::CMD_SWITCHVIEWID:
230
-					$view=$this->findControl($viewID=$param->getCommandParameter());
231
-					if($view!==null && $view->getParent()===$this)
230
+					$view = $this->findControl($viewID = $param->getCommandParameter());
231
+					if ($view !== null && $view->getParent() === $this)
232 232
 					{
233 233
 						$this->setActiveView($view);
234 234
 						return true;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 					else
237 237
 						throw new TInvalidDataValueException('multiview_viewid_invalid', $viewID);
238 238
 				case self::CMD_SWITCHVIEWINDEX:
239
-					$index=TPropertyValue::ensureInteger($param->getCommandParameter());
239
+					$index = TPropertyValue::ensureInteger($param->getCommandParameter());
240 240
 					$this->setActiveViewIndex($index);
241 241
 					return true;
242 242
 			}
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function render($writer)
262 262
 	{
263
-		if(($view=$this->getActiveView())!==null)
263
+		if (($view = $this->getActiveView()) !== null)
264 264
 			$view->renderControl($writer);
265 265
 	}
266 266
 }
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
 	 * @param mixed new item
284 284
 	 * @throws TInvalidDataTypeException if the item to be inserted is neither a string nor a TControl.
285 285
 	 */
286
-	public function insertAt($index,$item)
286
+	public function insertAt($index, $item)
287 287
 	{
288
-		if($item instanceof TView)
289
-			parent::insertAt($index,$item);
288
+		if ($item instanceof TView)
289
+			parent::insertAt($index, $item);
290 290
 		else
291 291
 			throw new TInvalidDataTypeException('viewcollection_view_required');
292 292
 	}
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
  */
310 310
 class TView extends TControl
311 311
 {
312
-	private $_active=false;
312
+	private $_active = false;
313 313
 
314 314
 	/**
315 315
 	 * Raises <b>OnActivate</b> event.
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public function onActivate($param)
319 319
 	{
320
-		$this->raiseEvent('OnActivate',$this,$param);
320
+		$this->raiseEvent('OnActivate', $this, $param);
321 321
 	}
322 322
 
323 323
 	/**
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 	 */
327 327
 	public function onDeactivate($param)
328 328
 	{
329
-		$this->raiseEvent('OnDeactivate',$this,$param);
329
+		$this->raiseEvent('OnDeactivate', $this, $param);
330 330
 	}
331 331
 
332 332
 	/**
@@ -342,8 +342,8 @@  discard block
 block discarded – undo
342 342
 	 */
343 343
 	public function setActive($value)
344 344
 	{
345
-		$value=TPropertyValue::ensureBoolean($value);
346
-		$this->_active=$value;
345
+		$value = TPropertyValue::ensureBoolean($value);
346
+		$this->_active = $value;
347 347
 		parent::setVisible($value);
348 348
 	}
349 349
 
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
 	 * @return boolean whether this view is visible.
353 353
 	 * The view is visible if it is active and its parent is visible.
354 354
 	 */
355
-	public function getVisible($checkParents=true)
355
+	public function getVisible($checkParents = true)
356 356
 	{
357
-		if(($parent=$this->getParent())===null)
357
+		if (($parent = $this->getParent()) === null)
358 358
 			return $this->getActive();
359
-		else if($this->getActive())
359
+		else if ($this->getActive())
360 360
 			return $parent->getVisible($checkParents);
361 361
 		else
362 362
 			return false;
Please login to merge, or discard this patch.
Braces   +70 added lines, -55 removed lines patch added patch discarded remove patch
@@ -53,10 +53,11 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function addParsedObject($object)
55 55
 	{
56
-		if($object instanceof TView)
57
-			$this->getControls()->add($object);
58
-		else if(!is_string($object))
59
-			throw new TConfigurationException('multiview_view_required');
56
+		if($object instanceof TView) {
57
+					$this->getControls()->add($object);
58
+		} else if(!is_string($object)) {
59
+					throw new TConfigurationException('multiview_view_required');
60
+		}
60 61
 	}
61 62
 
62 63
 	/**
@@ -73,10 +74,11 @@  discard block
 block discarded – undo
73 74
 	 */
74 75
 	public function getActiveViewIndex()
75 76
 	{
76
-		if($this->_cachedActiveViewIndex>-1)
77
-			return $this->_cachedActiveViewIndex;
78
-		else
79
-			return $this->getControlState('ActiveViewIndex',-1);
77
+		if($this->_cachedActiveViewIndex>-1) {
78
+					return $this->_cachedActiveViewIndex;
79
+		} else {
80
+					return $this->getControlState('ActiveViewIndex',-1);
81
+		}
80 82
 	}
81 83
 
82 84
 	/**
@@ -85,21 +87,23 @@  discard block
 block discarded – undo
85 87
 	 */
86 88
 	public function setActiveViewIndex($value)
87 89
 	{
88
-		if(($index=TPropertyValue::ensureInteger($value))<0)
89
-			$index=-1;
90
+		if(($index=TPropertyValue::ensureInteger($value))<0) {
91
+					$index=-1;
92
+		}
90 93
 		$views=$this->getViews();
91 94
 		$count=$views->getCount();
92
-		if($count===0 && $this->getControlStage()<TControl::CS_CHILD_INITIALIZED)
93
-			$this->_cachedActiveViewIndex=$index;
94
-		else if($index<$count)
95
+		if($count===0 && $this->getControlStage()<TControl::CS_CHILD_INITIALIZED) {
96
+					$this->_cachedActiveViewIndex=$index;
97
+		} else if($index<$count)
95 98
 		{
96 99
 			$this->setControlState('ActiveViewIndex',$index,-1);
97 100
 			$this->_cachedActiveViewIndex=-1;
98
-			if($index>=0)
99
-				$this->activateView($views->itemAt($index),true);
101
+			if($index>=0) {
102
+							$this->activateView($views->itemAt($index),true);
103
+			}
104
+		} else {
105
+					throw new TInvalidDataValueException('multiview_activeviewindex_invalid',$index);
100 106
 		}
101
-		else
102
-			throw new TInvalidDataValueException('multiview_activeviewindex_invalid',$index);
103 107
 	}
104 108
 
105 109
 	/**
@@ -110,13 +114,16 @@  discard block
 block discarded – undo
110 114
 	{
111 115
 		$index=$this->getActiveViewIndex();
112 116
 		$views=$this->getViews();
113
-		if($index>=$views->getCount())
114
-			throw new TInvalidDataValueException('multiview_activeviewindex_invalid',$index);
115
-		if($index<0)
116
-			return null;
117
+		if($index>=$views->getCount()) {
118
+					throw new TInvalidDataValueException('multiview_activeviewindex_invalid',$index);
119
+		}
120
+		if($index<0) {
121
+					return null;
122
+		}
117 123
 		$view=$views->itemAt($index);
118
-		if(!$view->getActive())
119
-			$this->activateView($view,false);
124
+		if(!$view->getActive()) {
125
+					$this->activateView($view,false);
126
+		}
120 127
 		return $view;
121 128
 	}
122 129
 
@@ -126,10 +133,11 @@  discard block
 block discarded – undo
126 133
 	 */
127 134
 	public function setActiveView($view)
128 135
 	{
129
-		if(($index=$this->getViews()->indexOf($view))>=0)
130
-			$this->setActiveViewIndex($index);
131
-		else
132
-			throw new TInvalidOperationException('multiview_view_inexistent');
136
+		if(($index=$this->getViews()->indexOf($view))>=0) {
137
+					$this->setActiveViewIndex($index);
138
+		} else {
139
+					throw new TInvalidOperationException('multiview_view_inexistent');
140
+		}
133 141
 	}
134 142
 
135 143
 	/**
@@ -140,8 +148,9 @@  discard block
 block discarded – undo
140 148
 	 */
141 149
 	protected function activateView($view,$triggerViewChangedEvent=true)
142 150
 	{
143
-		if($view->getActive())
144
-			return;
151
+		if($view->getActive()) {
152
+					return;
153
+		}
145 154
 		$triggerEvent=$triggerViewChangedEvent && ($this->getControlStage()>=TControl::CS_STATE_LOADED || ($this->getPage() && !$this->getPage()->getIsPostBack()));
146 155
 		foreach($this->getViews() as $v)
147 156
 		{
@@ -153,12 +162,12 @@  discard block
 block discarded – undo
153 162
 					$view->onActivate(null);
154 163
 					$this->onActiveViewChanged(null);
155 164
 				}
156
-			}
157
-			else if($v->getActive())
165
+			} else if($v->getActive())
158 166
 			{
159 167
 				$v->setActive(false);
160
-				if($triggerEvent)
161
-					$v->onDeactivate(null);
168
+				if($triggerEvent) {
169
+									$v->onDeactivate(null);
170
+				}
162 171
 			}
163 172
 		}
164 173
 	}
@@ -189,8 +198,9 @@  discard block
 block discarded – undo
189 198
 	public function onInit($param)
190 199
 	{
191 200
 		parent::onInit($param);
192
-		if($this->_cachedActiveViewIndex>=0)
193
-			$this->setActiveViewIndex($this->_cachedActiveViewIndex);
201
+		if($this->_cachedActiveViewIndex>=0) {
202
+					$this->setActiveViewIndex($this->_cachedActiveViewIndex);
203
+		}
194 204
 	}
195 205
 
196 206
 	/**
@@ -217,14 +227,16 @@  discard block
 block discarded – undo
217 227
 			switch($param->getCommandName())
218 228
 			{
219 229
 				case self::CMD_NEXTVIEW:
220
-					if(($index=$this->getActiveViewIndex())<$this->getViews()->getCount()-1)
221
-						$this->setActiveViewIndex($index+1);
222
-					else
223
-						$this->setActiveViewIndex(-1);
230
+					if(($index=$this->getActiveViewIndex())<$this->getViews()->getCount()-1) {
231
+											$this->setActiveViewIndex($index+1);
232
+					} else {
233
+											$this->setActiveViewIndex(-1);
234
+					}
224 235
 					return true;
225 236
 				case self::CMD_PREVIOUSVIEW:
226
-					if(($index=$this->getActiveViewIndex())>=0)
227
-						$this->setActiveViewIndex($index-1);
237
+					if(($index=$this->getActiveViewIndex())>=0) {
238
+											$this->setActiveViewIndex($index-1);
239
+					}
228 240
 					return true;
229 241
 				case self::CMD_SWITCHVIEWID:
230 242
 					$view=$this->findControl($viewID=$param->getCommandParameter());
@@ -232,9 +244,9 @@  discard block
 block discarded – undo
232 244
 					{
233 245
 						$this->setActiveView($view);
234 246
 						return true;
247
+					} else {
248
+											throw new TInvalidDataValueException('multiview_viewid_invalid', $viewID);
235 249
 					}
236
-					else
237
-						throw new TInvalidDataValueException('multiview_viewid_invalid', $viewID);
238 250
 				case self::CMD_SWITCHVIEWINDEX:
239 251
 					$index=TPropertyValue::ensureInteger($param->getCommandParameter());
240 252
 					$this->setActiveViewIndex($index);
@@ -260,8 +272,9 @@  discard block
 block discarded – undo
260 272
 	 */
261 273
 	public function render($writer)
262 274
 	{
263
-		if(($view=$this->getActiveView())!==null)
264
-			$view->renderControl($writer);
275
+		if(($view=$this->getActiveView())!==null) {
276
+					$view->renderControl($writer);
277
+		}
265 278
 	}
266 279
 }
267 280
 
@@ -285,10 +298,11 @@  discard block
 block discarded – undo
285 298
 	 */
286 299
 	public function insertAt($index,$item)
287 300
 	{
288
-		if($item instanceof TView)
289
-			parent::insertAt($index,$item);
290
-		else
291
-			throw new TInvalidDataTypeException('viewcollection_view_required');
301
+		if($item instanceof TView) {
302
+					parent::insertAt($index,$item);
303
+		} else {
304
+					throw new TInvalidDataTypeException('viewcollection_view_required');
305
+		}
292 306
 	}
293 307
 }
294 308
 
@@ -354,12 +368,13 @@  discard block
 block discarded – undo
354 368
 	 */
355 369
 	public function getVisible($checkParents=true)
356 370
 	{
357
-		if(($parent=$this->getParent())===null)
358
-			return $this->getActive();
359
-		else if($this->getActive())
360
-			return $parent->getVisible($checkParents);
361
-		else
362
-			return false;
371
+		if(($parent=$this->getParent())===null) {
372
+					return $this->getActive();
373
+		} else if($this->getActive()) {
374
+					return $parent->getVisible($checkParents);
375
+		} else {
376
+					return false;
377
+		}
363 378
 	}
364 379
 
365 380
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TOutputCache.php 4 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * into cache if needed.
232 232
 	 * This method should only be used by framework developers.
233 233
 	 * @param boolean whether the viewstate should be saved
234
-	 * @return array the collection of the control state (including its children's state).
234
+	 * @return string the collection of the control state (including its children's state).
235 235
 	 */
236 236
 	protected function &saveStateRecursive($needViewState=true)
237 237
 	{
@@ -327,6 +327,7 @@  discard block
 block discarded – undo
327 327
 	 * Sets the prefix of the cache key.
328 328
 	 * This method is used internally by {@link TTemplate}.
329 329
 	 * @param string key prefix
330
+	 * @param string $value
330 331
 	 */
331 332
 	public function setCacheKeyPrefix($value)
332 333
 	{
@@ -445,6 +446,7 @@  discard block
 block discarded – undo
445 446
 	 * The checking result should be saved by setting {@link TOutputCacheCheckDependencyEventParameter::setIsValid IsValid}
446 447
 	 * property of the event parameter (which defaults to true).
447 448
 	 * @param TOutputCacheCheckDependencyEventParameter event parameter
449
+	 * @param TOutputCacheCheckDependencyEventParameter $param
448 450
 	 */
449 451
 	public function onCheckDependency($param)
450 452
 	{
@@ -458,6 +460,7 @@  discard block
 block discarded – undo
458 460
 	 * The value set in {@link TOutputCacheCalculateKeyEventParameter::setCacheKey CacheKey} of
459 461
 	 * this event parameter will be appended to the default key calculation scheme.
460 462
 	 * @param TOutputCacheCalculateKeyEventParameter event parameter
463
+	 * @param TOutputCacheCalculateKeyEventParameter $param
461 464
 	 */
462 465
 	public function onCalculateKey($param)
463 466
 	{
Please login to merge, or discard this patch.
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -67,22 +67,22 @@  discard block
 block discarded – undo
67 67
  */
68 68
 class TOutputCache extends TControl implements INamingContainer
69 69
 {
70
-	const CACHE_ID_PREFIX='prado:outputcache';
71
-	private $_cacheModuleID='';
72
-	private $_dataCached=false;
73
-	private $_cacheAvailable=false;
74
-	private $_cacheChecked=false;
75
-	private $_cacheKey=null;
76
-	private $_duration=60;
77
-	private $_cache=null;
70
+	const CACHE_ID_PREFIX = 'prado:outputcache';
71
+	private $_cacheModuleID = '';
72
+	private $_dataCached = false;
73
+	private $_cacheAvailable = false;
74
+	private $_cacheChecked = false;
75
+	private $_cacheKey = null;
76
+	private $_duration = 60;
77
+	private $_cache = null;
78 78
 	private $_contents;
79 79
 	private $_state;
80
-	private $_actions=array();
81
-	private $_varyByParam='';
82
-	private $_keyPrefix='';
83
-	private $_varyBySession=false;
84
-	private $_cachePostBack=false;
85
-	private $_cacheTime=0;
80
+	private $_actions = array();
81
+	private $_varyByParam = '';
82
+	private $_keyPrefix = '';
83
+	private $_varyBySession = false;
84
+	private $_cachePostBack = false;
85
+	private $_cacheTime = 0;
86 86
 
87 87
 	/**
88 88
 	 * Returns a value indicating whether body contents are allowed for this control.
@@ -98,34 +98,34 @@  discard block
 block discarded – undo
98 98
 
99 99
 	private function determineCacheability()
100 100
 	{
101
-		if(!$this->_cacheChecked)
101
+		if (!$this->_cacheChecked)
102 102
 		{
103
-			$this->_cacheChecked=true;
104
-			if($this->_duration>0 && ($this->_cachePostBack || !$this->getPage()->getIsPostBack()))
103
+			$this->_cacheChecked = true;
104
+			if ($this->_duration > 0 && ($this->_cachePostBack || !$this->getPage()->getIsPostBack()))
105 105
 			{
106
-				if($this->_cacheModuleID!=='')
106
+				if ($this->_cacheModuleID !== '')
107 107
 				{
108
-					$this->_cache=$this->getApplication()->getModule($this->_cacheModuleID);
109
-					if(!($this->_cache instanceof ICache))
110
-						throw new TConfigurationException('outputcache_cachemoduleid_invalid',$this->_cacheModuleID);
108
+					$this->_cache = $this->getApplication()->getModule($this->_cacheModuleID);
109
+					if (!($this->_cache instanceof ICache))
110
+						throw new TConfigurationException('outputcache_cachemoduleid_invalid', $this->_cacheModuleID);
111 111
 				}
112 112
 				else
113
-					$this->_cache=$this->getApplication()->getCache();
114
-				if($this->_cache!==null)
113
+					$this->_cache = $this->getApplication()->getCache();
114
+				if ($this->_cache !== null)
115 115
 				{
116
-					$this->_cacheAvailable=true;
117
-					$data=$this->_cache->get($this->getCacheKey());
118
-					if(is_array($data))
116
+					$this->_cacheAvailable = true;
117
+					$data = $this->_cache->get($this->getCacheKey());
118
+					if (is_array($data))
119 119
 					{
120
-						$param=new TOutputCacheCheckDependencyEventParameter;
121
-						$param->setCacheTime(isset($data[3])?$data[3]:0);
120
+						$param = new TOutputCacheCheckDependencyEventParameter;
121
+						$param->setCacheTime(isset($data[3]) ? $data[3] : 0);
122 122
 						$this->onCheckDependency($param);
123
-						$this->_dataCached=$param->getIsValid();
123
+						$this->_dataCached = $param->getIsValid();
124 124
 					}
125 125
 					else
126
-						$this->_dataCached=false;
127
-					if($this->_dataCached)
128
-						list($this->_contents,$this->_state,$this->_actions,$this->_cacheTime)=$data;
126
+						$this->_dataCached = false;
127
+					if ($this->_dataCached)
128
+						list($this->_contents, $this->_state, $this->_actions, $this->_cacheTime) = $data;
129 129
 				}
130 130
 			}
131 131
 		}
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 	 * Only framework developers should use this method.
139 139
 	 * @param TControl the naming container control
140 140
 	 */
141
-	protected function initRecursive($namingContainer=null)
141
+	protected function initRecursive($namingContainer = null)
142 142
 	{
143
-		if($this->_cacheAvailable && !$this->_dataCached)
143
+		if ($this->_cacheAvailable && !$this->_dataCached)
144 144
 		{
145
-			$stack=$this->getPage()->getCachingStack();
145
+			$stack = $this->getPage()->getCachingStack();
146 146
 			$stack->push($this);
147 147
 			parent::initRecursive($namingContainer);
148 148
 			$stack->pop();
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function loadRecursive()
163 163
 	{
164
-		if($this->_cacheAvailable && !$this->_dataCached)
164
+		if ($this->_cacheAvailable && !$this->_dataCached)
165 165
 		{
166
-			$stack=$this->getPage()->getCachingStack();
166
+			$stack = $this->getPage()->getCachingStack();
167 167
 			$stack->push($this);
168 168
 			parent::loadRecursive();
169 169
 			$stack->pop();
170 170
 		}
171 171
 		else
172 172
 		{
173
-			if($this->_dataCached)
173
+			if ($this->_dataCached)
174 174
 				$this->performActions();
175 175
 			parent::loadRecursive();
176 176
 		}
@@ -178,16 +178,16 @@  discard block
 block discarded – undo
178 178
 
179 179
 	private function performActions()
180 180
 	{
181
-		$page=$this->getPage();
182
-		$cs=$page->getClientScript();
183
-		foreach($this->_actions as $action)
181
+		$page = $this->getPage();
182
+		$cs = $page->getClientScript();
183
+		foreach ($this->_actions as $action)
184 184
 		{
185
-			if($action[0]==='Page.ClientScript')
186
-				call_user_func_array(array($cs,$action[1]),$action[2]);
187
-			else if($action[0]==='Page')
188
-				call_user_func_array(array($page,$action[1]),$action[2]);
185
+			if ($action[0] === 'Page.ClientScript')
186
+				call_user_func_array(array($cs, $action[1]), $action[2]);
187
+			else if ($action[0] === 'Page')
188
+				call_user_func_array(array($page, $action[1]), $action[2]);
189 189
 			else
190
-				call_user_func_array(array($this->getSubProperty($action[0]),$action[1]),$action[2]);
190
+				call_user_func_array(array($this->getSubProperty($action[0]), $action[1]), $action[2]);
191 191
 		}
192 192
 	}
193 193
 
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	protected function preRenderRecursive()
202 202
 	{
203
-		if($this->_cacheAvailable && !$this->_dataCached)
203
+		if ($this->_cacheAvailable && !$this->_dataCached)
204 204
 		{
205
-			$stack=$this->getPage()->getCachingStack();
205
+			$stack = $this->getPage()->getCachingStack();
206 206
 			$stack->push($this);
207 207
 			parent::preRenderRecursive();
208 208
 			$stack->pop();
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 	 * @param array the collection of the state
220 220
 	 * @param boolean whether the viewstate should be loaded
221 221
 	 */
222
-	protected function loadStateRecursive(&$state,$needViewState=true)
222
+	protected function loadStateRecursive(&$state, $needViewState = true)
223 223
 	{
224
-		$st=unserialize($state);
225
-		parent::loadStateRecursive($st,$needViewState);
224
+		$st = unserialize($state);
225
+		parent::loadStateRecursive($st, $needViewState);
226 226
 	}
227 227
 
228 228
 	/**
@@ -233,15 +233,15 @@  discard block
 block discarded – undo
233 233
 	 * @param boolean whether the viewstate should be saved
234 234
 	 * @return array the collection of the control state (including its children's state).
235 235
 	 */
236
-	protected function &saveStateRecursive($needViewState=true)
236
+	protected function &saveStateRecursive($needViewState = true)
237 237
 	{
238
-		if($this->_dataCached)
238
+		if ($this->_dataCached)
239 239
 			return $this->_state;
240 240
 		else
241 241
 		{
242
-			$st=parent::saveStateRecursive($needViewState);
242
+			$st = parent::saveStateRecursive($needViewState);
243 243
 			// serialization is needed to avoid undefined classes when loading state
244
-			$this->_state=serialize($st);
244
+			$this->_state = serialize($st);
245 245
 			return $this->_state;
246 246
 		}
247 247
 	}
@@ -255,15 +255,15 @@  discard block
 block discarded – undo
255 255
 	 * @param string method name of the context object
256 256
 	 * @param array list of parameters to be passed to the action method
257 257
 	 */
258
-	public function registerAction($context,$funcName,$funcParams)
258
+	public function registerAction($context, $funcName, $funcParams)
259 259
 	{
260
-		$this->_actions[]=array($context,$funcName,$funcParams);
260
+		$this->_actions[] = array($context, $funcName, $funcParams);
261 261
 	}
262 262
 
263 263
 	public function getCacheKey()
264 264
 	{
265
-		if($this->_cacheKey===null)
266
-			$this->_cacheKey=$this->calculateCacheKey();
265
+		if ($this->_cacheKey === null)
266
+			$this->_cacheKey = $this->calculateCacheKey();
267 267
 		return $this->_cacheKey;
268 268
 	}
269 269
 
@@ -279,23 +279,23 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	protected function calculateCacheKey()
281 281
 	{
282
-		$key=$this->getBaseCacheKey();
283
-		if($this->_varyBySession)
284
-			$key.=$this->getSession()->getSessionID();
285
-		if($this->_varyByParam!=='')
282
+		$key = $this->getBaseCacheKey();
283
+		if ($this->_varyBySession)
284
+			$key .= $this->getSession()->getSessionID();
285
+		if ($this->_varyByParam !== '')
286 286
 		{
287
-			$params=array();
288
-			$request=$this->getRequest();
289
-			foreach(explode(',',$this->_varyByParam) as $name)
287
+			$params = array();
288
+			$request = $this->getRequest();
289
+			foreach (explode(',', $this->_varyByParam) as $name)
290 290
 			{
291
-				$name=trim($name);
292
-				$params[$name]=$request->itemAt($name);
291
+				$name = trim($name);
292
+				$params[$name] = $request->itemAt($name);
293 293
 			}
294
-			$key.=serialize($params);
294
+			$key .= serialize($params);
295 295
 		}
296
-		$param=new TOutputCacheCalculateKeyEventParameter;
296
+		$param = new TOutputCacheCalculateKeyEventParameter;
297 297
 		$this->onCalculateKey($param);
298
-		$key.=$param->getCacheKey();
298
+		$key .= $param->getCacheKey();
299 299
 		return $key;
300 300
 	}
301 301
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	 */
305 305
 	protected function getBaseCacheKey()
306 306
 	{
307
-		return self::CACHE_ID_PREFIX.$this->_keyPrefix.$this->getPage()->getPagePath().$this->getUniqueID();
307
+		return self::CACHE_ID_PREFIX . $this->_keyPrefix . $this->getPage()->getPagePath() . $this->getUniqueID();
308 308
 	}
309 309
 
310 310
 	/**
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	public function setCacheModuleID($value)
322 322
 	{
323
-		$this->_cacheModuleID=$value;
323
+		$this->_cacheModuleID = $value;
324 324
 	}
325 325
 
326 326
 	/**
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 */
331 331
 	public function setCacheKeyPrefix($value)
332 332
 	{
333
-		$this->_keyPrefix=$value;
333
+		$this->_keyPrefix = $value;
334 334
 	}
335 335
 
336 336
 	/**
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
 	 */
379 379
 	public function setDuration($value)
380 380
 	{
381
-		if(($value=TPropertyValue::ensureInteger($value))<0)
382
-			throw new TInvalidDataValueException('outputcache_duration_invalid',get_class($this));
383
-		$this->_duration=$value;
381
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
382
+			throw new TInvalidDataValueException('outputcache_duration_invalid', get_class($this));
383
+		$this->_duration = $value;
384 384
 	}
385 385
 
386 386
 	/**
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 	 */
401 401
 	public function setVaryByParam($value)
402 402
 	{
403
-		$this->_varyByParam=trim($value);
403
+		$this->_varyByParam = trim($value);
404 404
 	}
405 405
 
406 406
 	/**
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 */
417 417
 	public function setVaryBySession($value)
418 418
 	{
419
-		$this->_varyBySession=TPropertyValue::ensureBoolean($value);
419
+		$this->_varyBySession = TPropertyValue::ensureBoolean($value);
420 420
 	}
421 421
 
422 422
 	/**
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 	 */
437 437
 	public function setCachingPostBack($value)
438 438
 	{
439
-		$this->_cachePostBack=TPropertyValue::ensureBoolean($value);
439
+		$this->_cachePostBack = TPropertyValue::ensureBoolean($value);
440 440
 	}
441 441
 
442 442
 	/**
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 */
449 449
 	public function onCheckDependency($param)
450 450
 	{
451
-		$this->raiseEvent('OnCheckDependency',$this,$param);
451
+		$this->raiseEvent('OnCheckDependency', $this, $param);
452 452
 	}
453 453
 
454 454
 	/**
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	 */
462 462
 	public function onCalculateKey($param)
463 463
 	{
464
-		$this->raiseEvent('OnCalculateKey',$this,$param);
464
+		$this->raiseEvent('OnCalculateKey', $this, $param);
465 465
 	}
466 466
 
467 467
 	/**
@@ -472,22 +472,22 @@  discard block
 block discarded – undo
472 472
 	 */
473 473
 	public function render($writer)
474 474
 	{
475
-		if($this->_dataCached)
475
+		if ($this->_dataCached)
476 476
 			$writer->write($this->_contents);
477
-		else if($this->_cacheAvailable)
477
+		else if ($this->_cacheAvailable)
478 478
 		{
479 479
 			$textwriter = new TTextWriter();
480
-			$multiwriter = new TOutputCacheTextWriterMulti(array($writer->getWriter(),$textwriter));
480
+			$multiwriter = new TOutputCacheTextWriterMulti(array($writer->getWriter(), $textwriter));
481 481
 			$htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $multiwriter);
482 482
 
483
-			$stack=$this->getPage()->getCachingStack();
483
+			$stack = $this->getPage()->getCachingStack();
484 484
 			$stack->push($this);
485 485
 			parent::render($htmlWriter);
486 486
 			$stack->pop();
487 487
 
488
-			$content=$textwriter->flush();
489
-			$data=array($content,$this->_state,$this->_actions,time());
490
-			$this->_cache->set($this->getCacheKey(),$data,$this->getDuration(),$this->getCacheDependency());
488
+			$content = $textwriter->flush();
489
+			$data = array($content, $this->_state, $this->_actions, time());
490
+			$this->_cache->set($this->getCacheKey(), $data, $this->getDuration(), $this->getCacheDependency());
491 491
 		}
492 492
 		else
493 493
 			parent::render($writer);
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
  */
507 507
 class TOutputCacheCheckDependencyEventParameter extends TEventParameter
508 508
 {
509
-	private $_isValid=true;
510
-	private $_cacheTime=0;
509
+	private $_isValid = true;
510
+	private $_cacheTime = 0;
511 511
 
512 512
 	/**
513 513
 	 * @return boolean whether the dependency remains valid. Defaults to true.
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 	 */
523 523
 	public function setIsValid($value)
524 524
 	{
525
-		$this->_isValid=TPropertyValue::ensureBoolean($value);
525
+		$this->_isValid = TPropertyValue::ensureBoolean($value);
526 526
 	}
527 527
 
528 528
 	/**
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	 */
541 541
 	public function setCacheTime($value)
542 542
 	{
543
-		$this->_cacheTime=TPropertyValue::ensureInteger($value);
543
+		$this->_cacheTime = TPropertyValue::ensureInteger($value);
544 544
 	}
545 545
 }
546 546
 
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	/**
561 561
 	 * @var string cache key to be appended to the default calculation scheme.
562 562
 	 */
563
-	private $_cacheKey='';
563
+	private $_cacheKey = '';
564 564
 
565 565
 	/**
566 566
 	 * @return string cache key to be appended to the default calculation scheme.
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	 */
576 576
 	public function setCacheKey($value)
577 577
 	{
578
-		$this->_cacheKey=TPropertyValue::ensureString($value);
578
+		$this->_cacheKey = TPropertyValue::ensureString($value);
579 579
 	}
580 580
 }
581 581
 
@@ -602,13 +602,13 @@  discard block
 block discarded – undo
602 602
 
603 603
 	public function write($s)
604 604
 	{
605
-		foreach($this->_writers as $writer)
605
+		foreach ($this->_writers as $writer)
606 606
 			$writer->write($s);
607 607
 	}
608 608
 
609 609
 	public function flush()
610 610
 	{
611
-		foreach($this->_writers as $writer)
611
+		foreach ($this->_writers as $writer)
612 612
 			$s = $writer->flush();
613 613
 		return $s;
614 614
 	}
Please login to merge, or discard this patch.
Braces   +48 added lines, -40 removed lines patch added patch discarded remove patch
@@ -106,11 +106,12 @@  discard block
 block discarded – undo
106 106
 				if($this->_cacheModuleID!=='')
107 107
 				{
108 108
 					$this->_cache=$this->getApplication()->getModule($this->_cacheModuleID);
109
-					if(!($this->_cache instanceof ICache))
110
-						throw new TConfigurationException('outputcache_cachemoduleid_invalid',$this->_cacheModuleID);
109
+					if(!($this->_cache instanceof ICache)) {
110
+											throw new TConfigurationException('outputcache_cachemoduleid_invalid',$this->_cacheModuleID);
111
+					}
112
+				} else {
113
+									$this->_cache=$this->getApplication()->getCache();
111 114
 				}
112
-				else
113
-					$this->_cache=$this->getApplication()->getCache();
114 115
 				if($this->_cache!==null)
115 116
 				{
116 117
 					$this->_cacheAvailable=true;
@@ -121,11 +122,12 @@  discard block
 block discarded – undo
121 122
 						$param->setCacheTime(isset($data[3])?$data[3]:0);
122 123
 						$this->onCheckDependency($param);
123 124
 						$this->_dataCached=$param->getIsValid();
125
+					} else {
126
+											$this->_dataCached=false;
127
+					}
128
+					if($this->_dataCached) {
129
+											list($this->_contents,$this->_state,$this->_actions,$this->_cacheTime)=$data;
124 130
 					}
125
-					else
126
-						$this->_dataCached=false;
127
-					if($this->_dataCached)
128
-						list($this->_contents,$this->_state,$this->_actions,$this->_cacheTime)=$data;
129 131
 				}
130 132
 			}
131 133
 		}
@@ -146,9 +148,9 @@  discard block
 block discarded – undo
146 148
 			$stack->push($this);
147 149
 			parent::initRecursive($namingContainer);
148 150
 			$stack->pop();
151
+		} else {
152
+					parent::initRecursive($namingContainer);
149 153
 		}
150
-		else
151
-			parent::initRecursive($namingContainer);
152 154
 	}
153 155
 
154 156
 	/**
@@ -167,11 +169,11 @@  discard block
 block discarded – undo
167 169
 			$stack->push($this);
168 170
 			parent::loadRecursive();
169 171
 			$stack->pop();
170
-		}
171
-		else
172
+		} else
172 173
 		{
173
-			if($this->_dataCached)
174
-				$this->performActions();
174
+			if($this->_dataCached) {
175
+							$this->performActions();
176
+			}
175 177
 			parent::loadRecursive();
176 178
 		}
177 179
 	}
@@ -182,12 +184,13 @@  discard block
 block discarded – undo
182 184
 		$cs=$page->getClientScript();
183 185
 		foreach($this->_actions as $action)
184 186
 		{
185
-			if($action[0]==='Page.ClientScript')
186
-				call_user_func_array(array($cs,$action[1]),$action[2]);
187
-			else if($action[0]==='Page')
188
-				call_user_func_array(array($page,$action[1]),$action[2]);
189
-			else
190
-				call_user_func_array(array($this->getSubProperty($action[0]),$action[1]),$action[2]);
187
+			if($action[0]==='Page.ClientScript') {
188
+							call_user_func_array(array($cs,$action[1]),$action[2]);
189
+			} else if($action[0]==='Page') {
190
+							call_user_func_array(array($page,$action[1]),$action[2]);
191
+			} else {
192
+							call_user_func_array(array($this->getSubProperty($action[0]),$action[1]),$action[2]);
193
+			}
191 194
 		}
192 195
 	}
193 196
 
@@ -206,9 +209,9 @@  discard block
 block discarded – undo
206 209
 			$stack->push($this);
207 210
 			parent::preRenderRecursive();
208 211
 			$stack->pop();
212
+		} else {
213
+					parent::preRenderRecursive();
209 214
 		}
210
-		else
211
-			parent::preRenderRecursive();
212 215
 	}
213 216
 
214 217
 	/**
@@ -235,9 +238,9 @@  discard block
 block discarded – undo
235 238
 	 */
236 239
 	protected function &saveStateRecursive($needViewState=true)
237 240
 	{
238
-		if($this->_dataCached)
239
-			return $this->_state;
240
-		else
241
+		if($this->_dataCached) {
242
+					return $this->_state;
243
+		} else
241 244
 		{
242 245
 			$st=parent::saveStateRecursive($needViewState);
243 246
 			// serialization is needed to avoid undefined classes when loading state
@@ -262,8 +265,9 @@  discard block
 block discarded – undo
262 265
 
263 266
 	public function getCacheKey()
264 267
 	{
265
-		if($this->_cacheKey===null)
266
-			$this->_cacheKey=$this->calculateCacheKey();
268
+		if($this->_cacheKey===null) {
269
+					$this->_cacheKey=$this->calculateCacheKey();
270
+		}
267 271
 		return $this->_cacheKey;
268 272
 	}
269 273
 
@@ -280,8 +284,9 @@  discard block
 block discarded – undo
280 284
 	protected function calculateCacheKey()
281 285
 	{
282 286
 		$key=$this->getBaseCacheKey();
283
-		if($this->_varyBySession)
284
-			$key.=$this->getSession()->getSessionID();
287
+		if($this->_varyBySession) {
288
+					$key.=$this->getSession()->getSessionID();
289
+		}
285 290
 		if($this->_varyByParam!=='')
286 291
 		{
287 292
 			$params=array();
@@ -378,8 +383,9 @@  discard block
 block discarded – undo
378 383
 	 */
379 384
 	public function setDuration($value)
380 385
 	{
381
-		if(($value=TPropertyValue::ensureInteger($value))<0)
382
-			throw new TInvalidDataValueException('outputcache_duration_invalid',get_class($this));
386
+		if(($value=TPropertyValue::ensureInteger($value))<0) {
387
+					throw new TInvalidDataValueException('outputcache_duration_invalid',get_class($this));
388
+		}
383 389
 		$this->_duration=$value;
384 390
 	}
385 391
 
@@ -472,9 +478,9 @@  discard block
 block discarded – undo
472 478
 	 */
473 479
 	public function render($writer)
474 480
 	{
475
-		if($this->_dataCached)
476
-			$writer->write($this->_contents);
477
-		else if($this->_cacheAvailable)
481
+		if($this->_dataCached) {
482
+					$writer->write($this->_contents);
483
+		} else if($this->_cacheAvailable)
478 484
 		{
479 485
 			$textwriter = new TTextWriter();
480 486
 			$multiwriter = new TOutputCacheTextWriterMulti(array($writer->getWriter(),$textwriter));
@@ -488,9 +494,9 @@  discard block
 block discarded – undo
488 494
 			$content=$textwriter->flush();
489 495
 			$data=array($content,$this->_state,$this->_actions,time());
490 496
 			$this->_cache->set($this->getCacheKey(),$data,$this->getDuration(),$this->getCacheDependency());
497
+		} else {
498
+					parent::render($writer);
491 499
 		}
492
-		else
493
-			parent::render($writer);
494 500
 	}
495 501
 }
496 502
 
@@ -602,14 +608,16 @@  discard block
 block discarded – undo
602 608
 
603 609
 	public function write($s)
604 610
 	{
605
-		foreach($this->_writers as $writer)
606
-			$writer->write($s);
611
+		foreach($this->_writers as $writer) {
612
+					$writer->write($s);
613
+		}
607 614
 	}
608 615
 
609 616
 	public function flush()
610 617
 	{
611
-		foreach($this->_writers as $writer)
612
-			$s = $writer->flush();
618
+		foreach($this->_writers as $writer) {
619
+					$s = $writer->flush();
620
+		}
613 621
 		return $s;
614 622
 	}
615 623
 }
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * TOutputCache class file
4
- *
5
- * @author Qiang Xue <[email protected]>
6
- * @link https://github.com/pradosoft/prado
7
- * @copyright Copyright &copy; 2005-2015 The PRADO Group
8
- * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
- * @package System.Web.UI.WebControls
10
- */
3
+	 * TOutputCache class file
4
+	 *
5
+	 * @author Qiang Xue <[email protected]>
6
+	 * @link https://github.com/pradosoft/prado
7
+	 * @copyright Copyright &copy; 2005-2015 The PRADO Group
8
+	 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
+	 * @package System.Web.UI.WebControls
10
+	 */
11 11
 
12 12
 /**
13 13
  * TOutputCache class.
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TPager.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -333,6 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
 	/**
335 335
 	 * @param integer the zero-based index of the current page
336
+	 * @param integer $value
336 337
 	 * @throws TInvalidDataValueException if the value is less than 0
337 338
 	 */
338 339
 	protected function setCurrentPageIndex($value)
@@ -352,6 +353,7 @@  discard block
 block discarded – undo
352 353
 
353 354
 	/**
354 355
 	 * @param integer number of pages of data items available
356
+	 * @param integer $value
355 357
 	 * @throws TInvalidDataValueException if the value is less than 0
356 358
 	 */
357 359
 	protected function setPageCount($value)
@@ -446,6 +448,9 @@  discard block
 block discarded – undo
446 448
 	 * @param string caption of the button.
447 449
 	 * @param string CommandName corresponding to the OnCommand event of the button.
448 450
 	 * @param string CommandParameter corresponding to the OnCommand event of the button
451
+	 * @param TPagerButtonType $buttonType
452
+	 * @param boolean $enabled
453
+	 * @param string $commandName
449 454
 	 * @return mixed the button instance
450 455
 	 */
451 456
 	protected function createPagerButton($buttonType,$enabled,$text,$commandName,$commandParameter)
@@ -660,6 +665,7 @@  discard block
 block discarded – undo
660 665
 	/**
661 666
 	 * This event is raised when page index is changed due to a page button click.
662 667
 	 * @param TPagerPageChangedEventParameter event parameter
668
+	 * @param TPagerPageChangedEventParameter $param
663 669
 	 */
664 670
 	public function onPageIndexChanged($param)
665 671
 	{
Please login to merge, or discard this patch.
Spacing   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	/**
53 53
 	 * Command name that TPager understands.
54 54
 	 */
55
-	const CMD_PAGE='Page';
56
-	const CMD_PAGE_NEXT='Next';
57
-	const CMD_PAGE_PREV='Previous';
58
-	const CMD_PAGE_FIRST='First';
59
-	const CMD_PAGE_LAST='Last';
55
+	const CMD_PAGE = 'Page';
56
+	const CMD_PAGE_NEXT = 'Next';
57
+	const CMD_PAGE_PREV = 'Previous';
58
+	const CMD_PAGE_FIRST = 'First';
59
+	const CMD_PAGE_LAST = 'Last';
60 60
 
61
-	private $_pageCount=0;
61
+	private $_pageCount = 0;
62 62
 
63 63
 	/**
64 64
 	 * Restores the pager state.
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	public function loadState()
69 69
 	{
70 70
 		parent::loadState();
71
-		if($this->getEnableViewState(true))
71
+		if ($this->getEnableViewState(true))
72 72
 		{
73 73
 			$this->getControls()->clear();
74 74
 			$this->buildPager();
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function getControlToPaginate()
82 82
 	{
83
-		return $this->getViewState('ControlToPaginate','');
83
+		return $this->getViewState('ControlToPaginate', '');
84 84
 	}
85 85
 
86 86
 	/**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function setControlToPaginate($value)
93 93
 	{
94
-		$this->setViewState('ControlToPaginate',$value,'');
94
+		$this->setViewState('ControlToPaginate', $value, '');
95 95
 	}
96 96
 
97 97
 	/**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function getButtonCssClass()
102 102
 	{
103
-		return $this->getViewState('ButtonCssClass','');
103
+		return $this->getViewState('ButtonCssClass', '');
104 104
 	}
105 105
 
106 106
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function setButtonCssClass($value)
111 111
 	{
112
-		$this->setViewState('ButtonCssClass',TPropertyValue::ensureString($value,''),'');
112
+		$this->setViewState('ButtonCssClass', TPropertyValue::ensureString($value, ''), '');
113 113
 	}
114 114
 
115 115
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function getMode()
119 119
 	{
120
-		return $this->getViewState('Mode',TPagerMode::NextPrev);
120
+		return $this->getViewState('Mode', TPagerMode::NextPrev);
121 121
 	}
122 122
 
123 123
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function setMode($value)
127 127
 	{
128
-		$this->setViewState('Mode',TPropertyValue::ensureEnum($value,'TPagerMode'),TPagerMode::NextPrev);
128
+		$this->setViewState('Mode', TPropertyValue::ensureEnum($value, 'TPagerMode'), TPagerMode::NextPrev);
129 129
 	}
130 130
 
131 131
 	/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function getButtonType()
135 135
 	{
136
-		return $this->getViewState('ButtonType',TPagerButtonType::LinkButton);
136
+		return $this->getViewState('ButtonType', TPagerButtonType::LinkButton);
137 137
 	}
138 138
 
139 139
 	/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function setButtonType($value)
143 143
 	{
144
-		$this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'TPagerButtonType'),TPagerButtonType::LinkButton);
144
+		$this->setViewState('ButtonType', TPropertyValue::ensureEnum($value, 'TPagerButtonType'), TPagerButtonType::LinkButton);
145 145
 	}
146 146
 
147 147
 	/**
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	public function getNextPageText()
151 151
 	{
152
-		return $this->getViewState('NextPageText','>');
152
+		return $this->getViewState('NextPageText', '>');
153 153
 	}
154 154
 
155 155
 	/**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function setNextPageText($value)
159 159
 	{
160
-		$this->setViewState('NextPageText',$value,'>');
160
+		$this->setViewState('NextPageText', $value, '>');
161 161
 	}
162 162
 
163 163
 	/**
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	public function getPrevPageText()
167 167
 	{
168
-		return $this->getViewState('PrevPageText','<');
168
+		return $this->getViewState('PrevPageText', '<');
169 169
 	}
170 170
 
171 171
 	/**
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	public function setPrevPageText($value)
175 175
 	{
176
-		$this->setViewState('PrevPageText',$value,'<');
176
+		$this->setViewState('PrevPageText', $value, '<');
177 177
 	}
178 178
 
179 179
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function getFirstPageText()
183 183
 	{
184
-		return $this->getViewState('FirstPageText','<<');
184
+		return $this->getViewState('FirstPageText', '<<');
185 185
 	}
186 186
 
187 187
 	/**
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function setFirstPageText($value)
191 191
 	{
192
-		$this->setViewState('FirstPageText',$value,'<<');
192
+		$this->setViewState('FirstPageText', $value, '<<');
193 193
 	}
194 194
 
195 195
 	/**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 */
198 198
 	public function getLastPageText()
199 199
 	{
200
-		return $this->getViewState('LastPageText','>>');
200
+		return $this->getViewState('LastPageText', '>>');
201 201
 	}
202 202
 
203 203
 	/**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	public function setLastPageText($value)
207 207
 	{
208
-		$this->setViewState('LastPageText',$value,'>>');
208
+		$this->setViewState('LastPageText', $value, '>>');
209 209
 	}
210 210
 
211 211
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	public function getFirstPageImageUrl()
216 216
 	{
217
-		return $this->getViewState('FirstPageImageUrl','');
217
+		return $this->getViewState('FirstPageImageUrl', '');
218 218
 	}
219 219
 
220 220
 	/**
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	public function setFirstPageImageUrl($value)
225 225
 	{
226
-		$this->setViewState('FirstPageImageUrl',$value);
226
+		$this->setViewState('FirstPageImageUrl', $value);
227 227
 	}
228 228
 
229 229
 	/**
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 */
233 233
 	public function getLastPageImageUrl()
234 234
 	{
235
-		return $this->getViewState('LastPageImageUrl','');
235
+		return $this->getViewState('LastPageImageUrl', '');
236 236
 	}
237 237
 
238 238
 	/**
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public function setLastPageImageUrl($value)
243 243
 	{
244
-		$this->setViewState('LastPageImageUrl',$value);
244
+		$this->setViewState('LastPageImageUrl', $value);
245 245
 	}
246 246
 
247 247
 	/**
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	public function getNextPageImageUrl()
252 252
 	{
253
-		return $this->getViewState('NextPageImageUrl','');
253
+		return $this->getViewState('NextPageImageUrl', '');
254 254
 	}
255 255
 
256 256
 	/**
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	public function setNextPageImageUrl($value)
261 261
 	{
262
-		$this->setViewState('NextPageImageUrl',$value);
262
+		$this->setViewState('NextPageImageUrl', $value);
263 263
 	}
264 264
 
265 265
 	/**
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 */
269 269
 	public function getPrevPageImageUrl()
270 270
 	{
271
-		return $this->getViewState('PrevPageImageUrl','');
271
+		return $this->getViewState('PrevPageImageUrl', '');
272 272
 	}
273 273
 
274 274
 	/**
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 */
278 278
 	public function setPrevPageImageUrl($value)
279 279
 	{
280
-		$this->setViewState('PrevPageImageUrl',$value);
280
+		$this->setViewState('PrevPageImageUrl', $value);
281 281
 	}
282 282
 
283 283
 	/**
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 */
288 288
 	public function getNumericPageImageUrl()
289 289
 	{
290
-		return $this->getViewState('NumericPageImageUrl','');
290
+		return $this->getViewState('NumericPageImageUrl', '');
291 291
 	}
292 292
 
293 293
 	/**
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	public function setNumericPageImageUrl($value)
303 303
 	{
304
-		$this->setViewState('NumericPageImageUrl',$value);
304
+		$this->setViewState('NumericPageImageUrl', $value);
305 305
 	}
306 306
 
307 307
 	/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	public function getPageButtonCount()
311 311
 	{
312
-		return $this->getViewState('PageButtonCount',10);
312
+		return $this->getViewState('PageButtonCount', 10);
313 313
 	}
314 314
 
315 315
 	/**
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	public function setPageButtonCount($value)
320 320
 	{
321
-		if(($value=TPropertyValue::ensureInteger($value))<1)
321
+		if (($value = TPropertyValue::ensureInteger($value)) < 1)
322 322
 			throw new TInvalidDataValueException('pager_pagebuttoncount_invalid');
323
-		$this->setViewState('PageButtonCount',$value,10);
323
+		$this->setViewState('PageButtonCount', $value, 10);
324 324
 	}
325 325
 
326 326
 	/**
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 */
329 329
 	public function getCurrentPageIndex()
330 330
 	{
331
-		return $this->getViewState('CurrentPageIndex',0);
331
+		return $this->getViewState('CurrentPageIndex', 0);
332 332
 	}
333 333
 
334 334
 	/**
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
 	 */
338 338
 	protected function setCurrentPageIndex($value)
339 339
 	{
340
-		if(($value=TPropertyValue::ensureInteger($value))<0)
340
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
341 341
 			throw new TInvalidDataValueException('pager_currentpageindex_invalid');
342
-		$this->setViewState('CurrentPageIndex',$value,0);
342
+		$this->setViewState('CurrentPageIndex', $value, 0);
343 343
 	}
344 344
 
345 345
 	/**
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 */
348 348
 	public function getPageCount()
349 349
 	{
350
-		return $this->getViewState('PageCount',0);
350
+		return $this->getViewState('PageCount', 0);
351 351
 	}
352 352
 
353 353
 	/**
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 	 */
357 357
 	protected function setPageCount($value)
358 358
 	{
359
-		if(($value=TPropertyValue::ensureInteger($value))<0)
359
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
360 360
 			throw new TInvalidDataValueException('pager_pagecount_invalid');
361
-		$this->setViewState('PageCount',$value,0);
361
+		$this->setViewState('PageCount', $value, 0);
362 362
 	}
363 363
 
364 364
 	/**
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 */
367 367
 	public function getIsFirstPage()
368 368
 	{
369
-		return $this->getCurrentPageIndex()===0;
369
+		return $this->getCurrentPageIndex() === 0;
370 370
 	}
371 371
 
372 372
 	/**
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 */
375 375
 	public function getIsLastPage()
376 376
 	{
377
-		return $this->getCurrentPageIndex()===$this->getPageCount()-1;
377
+		return $this->getCurrentPageIndex() === $this->getPageCount() - 1;
378 378
 	}
379 379
 
380 380
 	/**
@@ -387,20 +387,20 @@  discard block
 block discarded – undo
387 387
 	{
388 388
 		parent::onPreRender($param);
389 389
 
390
-		$controlID=$this->getControlToPaginate();
391
-		if(($targetControl=$this->getNamingContainer()->findControl($controlID))===null || !($targetControl instanceof TDataBoundControl))
392
-			throw new TConfigurationException('pager_controltopaginate_invalid',$controlID);
390
+		$controlID = $this->getControlToPaginate();
391
+		if (($targetControl = $this->getNamingContainer()->findControl($controlID)) === null || !($targetControl instanceof TDataBoundControl))
392
+			throw new TConfigurationException('pager_controltopaginate_invalid', $controlID);
393 393
 
394
-		if($targetControl->getAllowPaging())
394
+		if ($targetControl->getAllowPaging())
395 395
 		{
396
-	 		$this->_pageCount=$targetControl->getPageCount();
396
+	 		$this->_pageCount = $targetControl->getPageCount();
397 397
 			$this->getControls()->clear();
398 398
 			$this->setPageCount($targetControl->getPageCount());
399 399
 			$this->setCurrentPageIndex($targetControl->getCurrentPageIndex());
400 400
 			$this->buildPager();
401 401
 		}
402 402
 		else
403
-			$this->_pageCount=0;
403
+			$this->_pageCount = 0;
404 404
 	}
405 405
 
406 406
 	/**
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 	 */
412 412
 	public function render($writer)
413 413
 	{
414
-		if($this->_pageCount>1)
414
+		if ($this->_pageCount > 1)
415 415
 			parent::render($writer);
416 416
 	}
417 417
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 */
423 423
 	protected function buildPager()
424 424
 	{
425
-		switch($this->getMode())
425
+		switch ($this->getMode())
426 426
 		{
427 427
 			case TPagerMode::NextPrev:
428 428
 				$this->buildNextPrevPager();
@@ -448,15 +448,15 @@  discard block
 block discarded – undo
448 448
 	 * @param string CommandParameter corresponding to the OnCommand event of the button
449 449
 	 * @return mixed the button instance
450 450
 	 */
451
-	protected function createPagerButton($buttonType,$enabled,$text,$commandName,$commandParameter)
451
+	protected function createPagerButton($buttonType, $enabled, $text, $commandName, $commandParameter)
452 452
 	{
453
-		if($buttonType===TPagerButtonType::LinkButton)
453
+		if ($buttonType === TPagerButtonType::LinkButton)
454 454
 		{
455
-			if($enabled)
456
-				$button=new TLinkButton;
455
+			if ($enabled)
456
+				$button = new TLinkButton;
457 457
 			else
458 458
 			{
459
-				$button=new TLabel;
459
+				$button = new TLabel;
460 460
 				$button->setText($text);
461 461
 				$button->setCssClass($this->getButtonCssClass());
462 462
 				return $button;
@@ -464,14 +464,14 @@  discard block
 block discarded – undo
464 464
 		}
465 465
 		else
466 466
 		{
467
-			if($buttonType===TPagerButtonType::ImageButton)
467
+			if ($buttonType === TPagerButtonType::ImageButton)
468 468
 			{
469
-				$button=new TImageButton;
470
-				$button->setImageUrl($this->getPageImageUrl($text,$commandName));
469
+				$button = new TImageButton;
470
+				$button->setImageUrl($this->getPageImageUrl($text, $commandName));
471 471
 			}
472 472
 			else
473
-				$button=new TButton;
474
-			if(!$enabled)
473
+				$button = new TButton;
474
+			if (!$enabled)
475 475
 				$button->setEnabled(false);
476 476
 		}
477 477
 		$button->setText($text);
@@ -487,13 +487,13 @@  discard block
 block discarded – undo
487 487
 	 * @param string the command name associated with the image button
488 488
 	 * @since 3.1.1
489 489
 	 */
490
-	protected function getPageImageUrl($text,$commandName)
490
+	protected function getPageImageUrl($text, $commandName)
491 491
 	{
492
-		switch($commandName)
492
+		switch ($commandName)
493 493
 		{
494 494
 			case self::CMD_PAGE:
495
-				$url=$this->getNumericPageImageUrl();
496
-				return str_replace('{0}',$text,$url);
495
+				$url = $this->getNumericPageImageUrl();
496
+				return str_replace('{0}', $text, $url);
497 497
 			case self::CMD_PAGE_NEXT:
498 498
 				return $this->getNextPageImageUrl();
499 499
 			case self::CMD_PAGE_PREV:
@@ -512,50 +512,50 @@  discard block
 block discarded – undo
512 512
 	 */
513 513
 	protected function buildNextPrevPager()
514 514
 	{
515
-		$buttonType=$this->getButtonType();
516
-		$controls=$this->getControls();
517
-		if($this->getIsFirstPage())
515
+		$buttonType = $this->getButtonType();
516
+		$controls = $this->getControls();
517
+		if ($this->getIsFirstPage())
518 518
 		{
519
-			if(($text=$this->getFirstPageText())!=='')
519
+			if (($text = $this->getFirstPageText()) !== '')
520 520
 			{
521
-				$label=$this->createPagerButton($buttonType,false,$text,self::CMD_PAGE_FIRST,'');
521
+				$label = $this->createPagerButton($buttonType, false, $text, self::CMD_PAGE_FIRST, '');
522 522
 				$controls->add($label);
523 523
 				$controls->add("\n");
524 524
 			}
525
-			$label=$this->createPagerButton($buttonType,false,$this->getPrevPageText(),self::CMD_PAGE_PREV,'');
525
+			$label = $this->createPagerButton($buttonType, false, $this->getPrevPageText(), self::CMD_PAGE_PREV, '');
526 526
 			$controls->add($label);
527 527
 		}
528 528
 		else
529 529
 		{
530
-			if(($text=$this->getFirstPageText())!=='')
530
+			if (($text = $this->getFirstPageText()) !== '')
531 531
 			{
532
-				$button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_FIRST,'');
532
+				$button = $this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_FIRST, '');
533 533
 				$controls->add($button);
534 534
 				$controls->add("\n");
535 535
 			}
536
-			$button=$this->createPagerButton($buttonType,true,$this->getPrevPageText(),self::CMD_PAGE_PREV,'');
536
+			$button = $this->createPagerButton($buttonType, true, $this->getPrevPageText(), self::CMD_PAGE_PREV, '');
537 537
 			$controls->add($button);
538 538
 		}
539 539
 		$controls->add("\n");
540
-		if($this->getIsLastPage())
540
+		if ($this->getIsLastPage())
541 541
 		{
542
-			$label=$this->createPagerButton($buttonType,false,$this->getNextPageText(),self::CMD_PAGE_NEXT,'');
542
+			$label = $this->createPagerButton($buttonType, false, $this->getNextPageText(), self::CMD_PAGE_NEXT, '');
543 543
 			$controls->add($label);
544
-			if(($text=$this->getLastPageText())!=='')
544
+			if (($text = $this->getLastPageText()) !== '')
545 545
 			{
546 546
 				$controls->add("\n");
547
-				$label=$this->createPagerButton($buttonType,false,$text,self::CMD_PAGE_LAST,'');
547
+				$label = $this->createPagerButton($buttonType, false, $text, self::CMD_PAGE_LAST, '');
548 548
 				$controls->add($label);
549 549
 			}
550 550
 		}
551 551
 		else
552 552
 		{
553
-			$button=$this->createPagerButton($buttonType,true,$this->getNextPageText(),self::CMD_PAGE_NEXT,'');
553
+			$button = $this->createPagerButton($buttonType, true, $this->getNextPageText(), self::CMD_PAGE_NEXT, '');
554 554
 			$controls->add($button);
555
-			if(($text=$this->getLastPageText())!=='')
555
+			if (($text = $this->getLastPageText()) !== '')
556 556
 			{
557 557
 				$controls->add("\n");
558
-				$button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_LAST,'');
558
+				$button = $this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_LAST, '');
559 559
 				$controls->add($button);
560 560
 			}
561 561
 		}
@@ -566,66 +566,66 @@  discard block
 block discarded – undo
566 566
 	 */
567 567
 	protected function buildNumericPager()
568 568
 	{
569
-		$buttonType=$this->getButtonType();
570
-		$controls=$this->getControls();
571
-		$pageCount=$this->getPageCount();
572
-		$pageIndex=$this->getCurrentPageIndex()+1;
573
-		$maxButtonCount=$this->getPageButtonCount();
574
-		$buttonCount=$maxButtonCount>$pageCount?$pageCount:$maxButtonCount;
575
-		$startPageIndex=1;
576
-		$endPageIndex=$buttonCount;
577
-		if($pageIndex>$endPageIndex)
569
+		$buttonType = $this->getButtonType();
570
+		$controls = $this->getControls();
571
+		$pageCount = $this->getPageCount();
572
+		$pageIndex = $this->getCurrentPageIndex() + 1;
573
+		$maxButtonCount = $this->getPageButtonCount();
574
+		$buttonCount = $maxButtonCount > $pageCount ? $pageCount : $maxButtonCount;
575
+		$startPageIndex = 1;
576
+		$endPageIndex = $buttonCount;
577
+		if ($pageIndex > $endPageIndex)
578 578
 		{
579
-			$startPageIndex=((int)(($pageIndex-1)/$maxButtonCount))*$maxButtonCount+1;
580
-			if(($endPageIndex=$startPageIndex+$maxButtonCount-1)>$pageCount)
581
-				$endPageIndex=$pageCount;
582
-			if($endPageIndex-$startPageIndex+1<$maxButtonCount)
579
+			$startPageIndex = ((int) (($pageIndex - 1) / $maxButtonCount)) * $maxButtonCount + 1;
580
+			if (($endPageIndex = $startPageIndex + $maxButtonCount - 1) > $pageCount)
581
+				$endPageIndex = $pageCount;
582
+			if ($endPageIndex - $startPageIndex + 1 < $maxButtonCount)
583 583
 			{
584
-				if(($startPageIndex=$endPageIndex-$maxButtonCount+1)<1)
585
-					$startPageIndex=1;
584
+				if (($startPageIndex = $endPageIndex - $maxButtonCount + 1) < 1)
585
+					$startPageIndex = 1;
586 586
 			}
587 587
 		}
588 588
 
589
-		if($startPageIndex>1)
589
+		if ($startPageIndex > 1)
590 590
 		{
591
-			if(($text=$this->getFirstPageText())!=='')
591
+			if (($text = $this->getFirstPageText()) !== '')
592 592
 			{
593
-				$button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_FIRST,'');
593
+				$button = $this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_FIRST, '');
594 594
 				$controls->add($button);
595 595
 				$controls->add("\n");
596 596
 			}
597
-			$prevPageIndex=$startPageIndex-1;
598
-			$button=$this->createPagerButton($buttonType,true,$this->getPrevPageText(),self::CMD_PAGE,"$prevPageIndex");
597
+			$prevPageIndex = $startPageIndex - 1;
598
+			$button = $this->createPagerButton($buttonType, true, $this->getPrevPageText(), self::CMD_PAGE, "$prevPageIndex");
599 599
 			$controls->add($button);
600 600
 			$controls->add("\n");
601 601
 		}
602 602
 
603
-		for($i=$startPageIndex;$i<=$endPageIndex;++$i)
603
+		for ($i = $startPageIndex; $i <= $endPageIndex; ++$i)
604 604
 		{
605
-			if($i===$pageIndex)
605
+			if ($i === $pageIndex)
606 606
 			{
607
-				$label=$this->createPagerButton($buttonType,false,"$i",self::CMD_PAGE,'');
607
+				$label = $this->createPagerButton($buttonType, false, "$i", self::CMD_PAGE, '');
608 608
 				$controls->add($label);
609 609
 			}
610 610
 			else
611 611
 			{
612
-				$button=$this->createPagerButton($buttonType,true,"$i",self::CMD_PAGE,"$i");
612
+				$button = $this->createPagerButton($buttonType, true, "$i", self::CMD_PAGE, "$i");
613 613
 				$controls->add($button);
614 614
 			}
615
-			if($i<$endPageIndex)
615
+			if ($i < $endPageIndex)
616 616
 				$controls->add("\n");
617 617
 		}
618 618
 
619
-		if($pageCount>$endPageIndex)
619
+		if ($pageCount > $endPageIndex)
620 620
 		{
621 621
 			$controls->add("\n");
622
-			$nextPageIndex=$endPageIndex+1;
623
-			$button=$this->createPagerButton($buttonType,true,$this->getNextPageText(),self::CMD_PAGE,"$nextPageIndex");
622
+			$nextPageIndex = $endPageIndex + 1;
623
+			$button = $this->createPagerButton($buttonType, true, $this->getNextPageText(), self::CMD_PAGE, "$nextPageIndex");
624 624
 			$controls->add($button);
625
-			if(($text=$this->getLastPageText())!=='')
625
+			if (($text = $this->getLastPageText()) !== '')
626 626
 			{
627 627
 				$controls->add("\n");
628
-				$button=$this->createPagerButton($buttonType,true,$text,self::CMD_PAGE_LAST,'');
628
+				$button = $this->createPagerButton($buttonType, true, $text, self::CMD_PAGE_LAST, '');
629 629
 				$controls->add($button);
630 630
 			}
631 631
 		}
@@ -636,13 +636,13 @@  discard block
 block discarded – undo
636 636
 	 */
637 637
 	protected function buildListPager()
638 638
 	{
639
-		$list=new TDropDownList;
639
+		$list = new TDropDownList;
640 640
 		$this->getControls()->add($list);
641
-		$list->setDataSource(range(1,$this->getPageCount()));
641
+		$list->setDataSource(range(1, $this->getPageCount()));
642 642
 		$list->dataBind();
643 643
 		$list->setSelectedIndex($this->getCurrentPageIndex());
644 644
 		$list->setAutoPostBack(true);
645
-		$list->attachEventHandler('OnSelectedIndexChanged',array($this,'listIndexChanged'));
645
+		$list->attachEventHandler('OnSelectedIndexChanged', array($this, 'listIndexChanged'));
646 646
 	}
647 647
 
648 648
 	/**
@@ -651,10 +651,10 @@  discard block
 block discarded – undo
651 651
 	 * @param TDropDownList the dropdown list control raising the event
652 652
 	 * @param TEventParameter event parameter
653 653
 	 */
654
-	public function listIndexChanged($sender,$param)
654
+	public function listIndexChanged($sender, $param)
655 655
 	{
656
-		$pageIndex=$sender->getSelectedIndex();
657
-		$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
656
+		$pageIndex = $sender->getSelectedIndex();
657
+		$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex));
658 658
 	}
659 659
 
660 660
 	/**
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	 */
664 664
 	public function onPageIndexChanged($param)
665 665
 	{
666
-		$this->raiseEvent('OnPageIndexChanged',$this,$param);
666
+		$this->raiseEvent('OnPageIndexChanged', $this, $param);
667 667
 	}
668 668
 
669 669
 	/**
@@ -674,37 +674,37 @@  discard block
 block discarded – undo
674 674
 	 * @param TEventParameter event parameter
675 675
 	 * @return boolean whether the event bubbling should stop here.
676 676
 	 */
677
-	public function bubbleEvent($sender,$param)
677
+	public function bubbleEvent($sender, $param)
678 678
 	{
679
-		if($param instanceof TCommandEventParameter)
679
+		if ($param instanceof TCommandEventParameter)
680 680
 		{
681
-			$command=$param->getCommandName();
682
-			if(strcasecmp($command,self::CMD_PAGE)===0)
681
+			$command = $param->getCommandName();
682
+			if (strcasecmp($command, self::CMD_PAGE) === 0)
683 683
 			{
684
-				$pageIndex=TPropertyValue::ensureInteger($param->getCommandParameter())-1;
685
-				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
684
+				$pageIndex = TPropertyValue::ensureInteger($param->getCommandParameter()) - 1;
685
+				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex));
686 686
 				return true;
687 687
 			}
688
-			else if(strcasecmp($command,self::CMD_PAGE_NEXT)===0)
688
+			else if (strcasecmp($command, self::CMD_PAGE_NEXT) === 0)
689 689
 			{
690
-				$pageIndex=$this->getCurrentPageIndex()+1;
691
-				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
690
+				$pageIndex = $this->getCurrentPageIndex() + 1;
691
+				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex));
692 692
 				return true;
693 693
 			}
694
-			else if(strcasecmp($command,self::CMD_PAGE_PREV)===0)
694
+			else if (strcasecmp($command, self::CMD_PAGE_PREV) === 0)
695 695
 			{
696
-				$pageIndex=$this->getCurrentPageIndex()-1;
697
-				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
696
+				$pageIndex = $this->getCurrentPageIndex() - 1;
697
+				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex));
698 698
 				return true;
699 699
 			}
700
-			else if(strcasecmp($command,self::CMD_PAGE_FIRST)===0)
700
+			else if (strcasecmp($command, self::CMD_PAGE_FIRST) === 0)
701 701
 			{
702
-				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,0));
702
+				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, 0));
703 703
 				return true;
704 704
 			}
705
-			else if(strcasecmp($command,self::CMD_PAGE_LAST)===0)
705
+			else if (strcasecmp($command, self::CMD_PAGE_LAST) === 0)
706 706
 			{
707
-				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$this->getPageCount()-1));
707
+				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $this->getPageCount() - 1));
708 708
 				return true;
709 709
 			}
710 710
 			return false;
@@ -737,17 +737,17 @@  discard block
 block discarded – undo
737 737
 	/**
738 738
 	 * @var TControl original event sender
739 739
 	 */
740
-	private $_source=null;
740
+	private $_source = null;
741 741
 
742 742
 	/**
743 743
 	 * Constructor.
744 744
 	 * @param TControl the control originally raises the <b>OnCommand</b> event.
745 745
 	 * @param integer new page index
746 746
 	 */
747
-	public function __construct($source,$newPageIndex)
747
+	public function __construct($source, $newPageIndex)
748 748
 	{
749
-		$this->_source=$source;
750
-		$this->_newIndex=$newPageIndex;
749
+		$this->_source = $source;
750
+		$this->_newIndex = $newPageIndex;
751 751
 	}
752 752
 
753 753
 	/**
@@ -783,9 +783,9 @@  discard block
 block discarded – undo
783 783
  */
784 784
 class TPagerMode extends TEnumerable
785 785
 {
786
-	const NextPrev='NextPrev';
787
-	const Numeric='Numeric';
788
-	const DropDownList='DropDownList';
786
+	const NextPrev = 'NextPrev';
787
+	const Numeric = 'Numeric';
788
+	const DropDownList = 'DropDownList';
789 789
 }
790 790
 
791 791
 
@@ -803,8 +803,8 @@  discard block
 block discarded – undo
803 803
  */
804 804
 class TPagerButtonType extends TEnumerable
805 805
 {
806
-	const LinkButton='LinkButton';
807
-	const PushButton='PushButton';
808
-	const ImageButton='ImageButton';
806
+	const LinkButton = 'LinkButton';
807
+	const PushButton = 'PushButton';
808
+	const ImageButton = 'ImageButton';
809 809
 }
810 810
 
Please login to merge, or discard this patch.
Braces   +44 added lines, -43 removed lines patch added patch discarded remove patch
@@ -318,8 +318,9 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	public function setPageButtonCount($value)
320 320
 	{
321
-		if(($value=TPropertyValue::ensureInteger($value))<1)
322
-			throw new TInvalidDataValueException('pager_pagebuttoncount_invalid');
321
+		if(($value=TPropertyValue::ensureInteger($value))<1) {
322
+					throw new TInvalidDataValueException('pager_pagebuttoncount_invalid');
323
+		}
323 324
 		$this->setViewState('PageButtonCount',$value,10);
324 325
 	}
325 326
 
@@ -337,8 +338,9 @@  discard block
 block discarded – undo
337 338
 	 */
338 339
 	protected function setCurrentPageIndex($value)
339 340
 	{
340
-		if(($value=TPropertyValue::ensureInteger($value))<0)
341
-			throw new TInvalidDataValueException('pager_currentpageindex_invalid');
341
+		if(($value=TPropertyValue::ensureInteger($value))<0) {
342
+					throw new TInvalidDataValueException('pager_currentpageindex_invalid');
343
+		}
342 344
 		$this->setViewState('CurrentPageIndex',$value,0);
343 345
 	}
344 346
 
@@ -356,8 +358,9 @@  discard block
 block discarded – undo
356 358
 	 */
357 359
 	protected function setPageCount($value)
358 360
 	{
359
-		if(($value=TPropertyValue::ensureInteger($value))<0)
360
-			throw new TInvalidDataValueException('pager_pagecount_invalid');
361
+		if(($value=TPropertyValue::ensureInteger($value))<0) {
362
+					throw new TInvalidDataValueException('pager_pagecount_invalid');
363
+		}
361 364
 		$this->setViewState('PageCount',$value,0);
362 365
 	}
363 366
 
@@ -388,8 +391,9 @@  discard block
 block discarded – undo
388 391
 		parent::onPreRender($param);
389 392
 
390 393
 		$controlID=$this->getControlToPaginate();
391
-		if(($targetControl=$this->getNamingContainer()->findControl($controlID))===null || !($targetControl instanceof TDataBoundControl))
392
-			throw new TConfigurationException('pager_controltopaginate_invalid',$controlID);
394
+		if(($targetControl=$this->getNamingContainer()->findControl($controlID))===null || !($targetControl instanceof TDataBoundControl)) {
395
+					throw new TConfigurationException('pager_controltopaginate_invalid',$controlID);
396
+		}
393 397
 
394 398
 		if($targetControl->getAllowPaging())
395 399
 		{
@@ -398,9 +402,9 @@  discard block
 block discarded – undo
398 402
 			$this->setPageCount($targetControl->getPageCount());
399 403
 			$this->setCurrentPageIndex($targetControl->getCurrentPageIndex());
400 404
 			$this->buildPager();
405
+		} else {
406
+					$this->_pageCount=0;
401 407
 		}
402
-		else
403
-			$this->_pageCount=0;
404 408
 	}
405 409
 
406 410
 	/**
@@ -411,8 +415,9 @@  discard block
 block discarded – undo
411 415
 	 */
412 416
 	public function render($writer)
413 417
 	{
414
-		if($this->_pageCount>1)
415
-			parent::render($writer);
418
+		if($this->_pageCount>1) {
419
+					parent::render($writer);
420
+		}
416 421
 	}
417 422
 
418 423
 	/**
@@ -452,27 +457,27 @@  discard block
 block discarded – undo
452 457
 	{
453 458
 		if($buttonType===TPagerButtonType::LinkButton)
454 459
 		{
455
-			if($enabled)
456
-				$button=new TLinkButton;
457
-			else
460
+			if($enabled) {
461
+							$button=new TLinkButton;
462
+			} else
458 463
 			{
459 464
 				$button=new TLabel;
460 465
 				$button->setText($text);
461 466
 				$button->setCssClass($this->getButtonCssClass());
462 467
 				return $button;
463 468
 			}
464
-		}
465
-		else
469
+		} else
466 470
 		{
467 471
 			if($buttonType===TPagerButtonType::ImageButton)
468 472
 			{
469 473
 				$button=new TImageButton;
470 474
 				$button->setImageUrl($this->getPageImageUrl($text,$commandName));
475
+			} else {
476
+							$button=new TButton;
477
+			}
478
+			if(!$enabled) {
479
+							$button->setEnabled(false);
471 480
 			}
472
-			else
473
-				$button=new TButton;
474
-			if(!$enabled)
475
-				$button->setEnabled(false);
476 481
 		}
477 482
 		$button->setText($text);
478 483
 		$button->setCommandName($commandName);
@@ -524,8 +529,7 @@  discard block
 block discarded – undo
524 529
 			}
525 530
 			$label=$this->createPagerButton($buttonType,false,$this->getPrevPageText(),self::CMD_PAGE_PREV,'');
526 531
 			$controls->add($label);
527
-		}
528
-		else
532
+		} else
529 533
 		{
530 534
 			if(($text=$this->getFirstPageText())!=='')
531 535
 			{
@@ -547,8 +551,7 @@  discard block
 block discarded – undo
547 551
 				$label=$this->createPagerButton($buttonType,false,$text,self::CMD_PAGE_LAST,'');
548 552
 				$controls->add($label);
549 553
 			}
550
-		}
551
-		else
554
+		} else
552 555
 		{
553 556
 			$button=$this->createPagerButton($buttonType,true,$this->getNextPageText(),self::CMD_PAGE_NEXT,'');
554 557
 			$controls->add($button);
@@ -577,12 +580,14 @@  discard block
 block discarded – undo
577 580
 		if($pageIndex>$endPageIndex)
578 581
 		{
579 582
 			$startPageIndex=((int)(($pageIndex-1)/$maxButtonCount))*$maxButtonCount+1;
580
-			if(($endPageIndex=$startPageIndex+$maxButtonCount-1)>$pageCount)
581
-				$endPageIndex=$pageCount;
583
+			if(($endPageIndex=$startPageIndex+$maxButtonCount-1)>$pageCount) {
584
+							$endPageIndex=$pageCount;
585
+			}
582 586
 			if($endPageIndex-$startPageIndex+1<$maxButtonCount)
583 587
 			{
584
-				if(($startPageIndex=$endPageIndex-$maxButtonCount+1)<1)
585
-					$startPageIndex=1;
588
+				if(($startPageIndex=$endPageIndex-$maxButtonCount+1)<1) {
589
+									$startPageIndex=1;
590
+				}
586 591
 			}
587 592
 		}
588 593
 
@@ -606,14 +611,14 @@  discard block
 block discarded – undo
606 611
 			{
607 612
 				$label=$this->createPagerButton($buttonType,false,"$i",self::CMD_PAGE,'');
608 613
 				$controls->add($label);
609
-			}
610
-			else
614
+			} else
611 615
 			{
612 616
 				$button=$this->createPagerButton($buttonType,true,"$i",self::CMD_PAGE,"$i");
613 617
 				$controls->add($button);
614 618
 			}
615
-			if($i<$endPageIndex)
616
-				$controls->add("\n");
619
+			if($i<$endPageIndex) {
620
+							$controls->add("\n");
621
+			}
617 622
 		}
618 623
 
619 624
 		if($pageCount>$endPageIndex)
@@ -684,33 +689,29 @@  discard block
 block discarded – undo
684 689
 				$pageIndex=TPropertyValue::ensureInteger($param->getCommandParameter())-1;
685 690
 				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
686 691
 				return true;
687
-			}
688
-			else if(strcasecmp($command,self::CMD_PAGE_NEXT)===0)
692
+			} else if(strcasecmp($command,self::CMD_PAGE_NEXT)===0)
689 693
 			{
690 694
 				$pageIndex=$this->getCurrentPageIndex()+1;
691 695
 				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
692 696
 				return true;
693
-			}
694
-			else if(strcasecmp($command,self::CMD_PAGE_PREV)===0)
697
+			} else if(strcasecmp($command,self::CMD_PAGE_PREV)===0)
695 698
 			{
696 699
 				$pageIndex=$this->getCurrentPageIndex()-1;
697 700
 				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$pageIndex));
698 701
 				return true;
699
-			}
700
-			else if(strcasecmp($command,self::CMD_PAGE_FIRST)===0)
702
+			} else if(strcasecmp($command,self::CMD_PAGE_FIRST)===0)
701 703
 			{
702 704
 				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,0));
703 705
 				return true;
704
-			}
705
-			else if(strcasecmp($command,self::CMD_PAGE_LAST)===0)
706
+			} else if(strcasecmp($command,self::CMD_PAGE_LAST)===0)
706 707
 			{
707 708
 				$this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender,$this->getPageCount()-1));
708 709
 				return true;
709 710
 			}
710 711
 			return false;
712
+		} else {
713
+					return false;
711 714
 		}
712
-		else
713
-			return false;
714 715
 	}
715 716
 }
716 717
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TRangeValidator.php 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -96,6 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
 	/**
98 98
 	 * @param boolean true to perform strict comparison (i.e. strictly less than max and/or strictly greater than min).
99
+	 * @param boolean $value
99 100
 	 */
100 101
 	public function setStrictComparison($value)
101 102
 	{
@@ -191,6 +192,7 @@  discard block
 block discarded – undo
191 192
 	/**
192 193
 	* Determine if the value is within the integer range.
193 194
 	* @param string value to validate true
195
+	* @param string $value
194 196
 	* @return boolean true if within integer range.
195 197
 	*/
196 198
 	protected function isValidInteger($value)
@@ -220,6 +222,7 @@  discard block
 block discarded – undo
220 222
 	/**
221 223
 	 * Determine if the value is within the specified float range.
222 224
 	 * @param string value to validate
225
+	 * @param string $value
223 226
 	 * @return boolean true if within range.
224 227
 	 */
225 228
 	protected function isValidFloat($value)
@@ -240,6 +243,7 @@  discard block
 block discarded – undo
240 243
 	 * Determine if the date is within the specified range.
241 244
 	 * Uses pradoParseDate and strtotime to get the date from string.
242 245
 	 * @param string date as string to validate
246
+	 * @param string $value
243 247
 	 * @return boolean true if within range.
244 248
 	 */
245 249
 	protected function isValidDate($value)
@@ -275,6 +279,7 @@  discard block
 block discarded – undo
275 279
 	 * Compare the string with a minimum and a maxiumum value.
276 280
 	 * Uses strcmp for comparision.
277 281
 	 * @param string value to compare with.
282
+	 * @param string $value
278 283
 	 * @return boolean true if the string is within range.
279 284
 	 */
280 285
 	protected function isValidString($value)
@@ -292,6 +297,7 @@  discard block
 block discarded – undo
292 297
 
293 298
 	/**
294 299
 	 * @param string string for comparision
300
+	 * @param string $value
295 301
 	 * @return boolean true if min and max string length are satisfied.
296 302
 	 */
297 303
 	protected function isValidStringLength($value)
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public function getMinValue()
67 67
 	{
68
-		return $this->getViewState('MinValue','');
68
+		return $this->getViewState('MinValue', '');
69 69
 	}
70 70
 
71 71
 	/**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function setMinValue($value)
76 76
 	{
77
-		$this->setViewState('MinValue',TPropertyValue::ensureString($value),'');
77
+		$this->setViewState('MinValue', TPropertyValue::ensureString($value), '');
78 78
 	}
79 79
 
80 80
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function getMaxValue()
84 84
 	{
85
-		return $this->getViewState('MaxValue','');
85
+		return $this->getViewState('MaxValue', '');
86 86
 	}
87 87
 
88 88
 	/**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function setMaxValue($value)
93 93
 	{
94
-		$this->setViewState('MaxValue',TPropertyValue::ensureString($value),'');
94
+		$this->setViewState('MaxValue', TPropertyValue::ensureString($value), '');
95 95
 	}
96 96
 
97 97
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function setStrictComparison($value)
101 101
 	{
102
-		$this->setViewState('StrictComparison', TPropertyValue::ensureBoolean($value),false);
102
+		$this->setViewState('StrictComparison', TPropertyValue::ensureBoolean($value), false);
103 103
 	}
104 104
 
105 105
 	/**
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function getDataType()
118 118
 	{
119
-		return $this->getViewState('DataType',TRangeValidationDataType::String);
119
+		return $this->getViewState('DataType', TRangeValidationDataType::String);
120 120
 	}
121 121
 
122 122
 	/**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public function setDataType($value)
127 127
 	{
128
-		$this->setViewState('DataType',TPropertyValue::ensureEnum($value,'TRangeValidationDataType'),TRangeValidationDataType::String);
128
+		$this->setViewState('DataType', TPropertyValue::ensureEnum($value, 'TRangeValidationDataType'), TRangeValidationDataType::String);
129 129
 	}
130 130
 
131 131
 	/**
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	protected function evaluateIsValid()
171 171
 	{
172
-		$value=$this->getValidationValue($this->getValidationTarget());
173
-		if($value==='')
172
+		$value = $this->getValidationValue($this->getValidationTarget());
173
+		if ($value === '')
174 174
 			return true;
175 175
 
176
-		switch($this->getDataType())
176
+		switch ($this->getDataType())
177 177
 		{
178 178
 			case TRangeValidationDataType::Integer:
179 179
 				return $this->isValidInteger($value);
@@ -195,19 +195,19 @@  discard block
 block discarded – undo
195 195
 	*/
196 196
 	protected function isValidInteger($value)
197 197
 	{
198
-		$minValue=$this->getMinValue();
199
-		$maxValue=$this->getMaxValue();
200
-
201
-		$valid=preg_match('/^[-+]?[0-9]+$/',trim($value));
202
-		$value=intval($value);
203
-		if($minValue!=='')
204
-			$valid=$valid && $this->isGreaterThan($value, intval($minValue));
205
-		if($maxValue!=='')
206
-			$valid=$valid && $this->isLessThan($value,intval($maxValue));
198
+		$minValue = $this->getMinValue();
199
+		$maxValue = $this->getMaxValue();
200
+
201
+		$valid = preg_match('/^[-+]?[0-9]+$/', trim($value));
202
+		$value = intval($value);
203
+		if ($minValue !== '')
204
+			$valid = $valid && $this->isGreaterThan($value, intval($minValue));
205
+		if ($maxValue !== '')
206
+			$valid = $valid && $this->isLessThan($value, intval($maxValue));
207 207
 		return $valid;
208 208
 	}
209 209
 
210
-	protected function isLessThan($left,$right)
210
+	protected function isLessThan($left, $right)
211 211
 	{
212 212
 		return $this->getStrictComparison() ? $left < $right : $left <= $right;
213 213
 	}
@@ -224,15 +224,15 @@  discard block
 block discarded – undo
224 224
 	 */
225 225
 	protected function isValidFloat($value)
226 226
 	{
227
-		$minValue=$this->getMinValue();
228
-		$maxValue=$this->getMaxValue();
229
-
230
-		$valid=preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value));
231
-		$value=floatval($value);
232
-		if($minValue!=='')
233
-			$valid=$valid && $this->isGreaterThan($value,floatval($minValue));
234
-		if($maxValue!=='')
235
-			$valid=$valid && $this->isLessThan($value,floatval($maxValue));
227
+		$minValue = $this->getMinValue();
228
+		$maxValue = $this->getMaxValue();
229
+
230
+		$valid = preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/', trim($value));
231
+		$value = floatval($value);
232
+		if ($minValue !== '')
233
+			$valid = $valid && $this->isGreaterThan($value, floatval($minValue));
234
+		if ($maxValue !== '')
235
+			$valid = $valid && $this->isLessThan($value, floatval($maxValue));
236 236
 		return $valid;
237 237
 	}
238 238
 
@@ -244,29 +244,29 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	protected function isValidDate($value)
246 246
 	{
247
-		$minValue=$this->getMinValue();
248
-		$maxValue=$this->getMaxValue();
247
+		$minValue = $this->getMinValue();
248
+		$maxValue = $this->getMaxValue();
249 249
 
250
-		$valid=true;
250
+		$valid = true;
251 251
 
252 252
 		$dateFormat = $this->getDateFormat();
253
-		if($dateFormat!=='')
253
+		if ($dateFormat !== '')
254 254
 		{
255
-			$formatter=Prado::createComponent('System.Util.TSimpleDateFormatter', $dateFormat);
255
+			$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $dateFormat);
256 256
 			$value = $formatter->parse($value);
257
-			if($minValue!=='')
258
-				$valid=$valid && $this->isGreaterThan($value,$formatter->parse($minValue));
259
-			if($maxValue!=='')
260
-				$valid=$valid && $this->isLessThan($value,$formatter->parse($maxValue));
257
+			if ($minValue !== '')
258
+				$valid = $valid && $this->isGreaterThan($value, $formatter->parse($minValue));
259
+			if ($maxValue !== '')
260
+				$valid = $valid && $this->isLessThan($value, $formatter->parse($maxValue));
261 261
 			return $valid;
262 262
 		}
263 263
 		else
264 264
 		{
265
-			$value=strtotime($value);
266
-			if($minValue!=='')
267
-				$valid=$valid && $this->isGreaterThan($value,strtotime($minValue));
268
-			if($maxValue!=='')
269
-				$valid=$valid && $this->isLessThan($value,strtotime($maxValue));
265
+			$value = strtotime($value);
266
+			if ($minValue !== '')
267
+				$valid = $valid && $this->isGreaterThan($value, strtotime($minValue));
268
+			if ($maxValue !== '')
269
+				$valid = $valid && $this->isLessThan($value, strtotime($maxValue));
270 270
 			return $valid;
271 271
 		}
272 272
 	}
@@ -279,14 +279,14 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	protected function isValidString($value)
281 281
 	{
282
-		$minValue=$this->getMinValue();
283
-		$maxValue=$this->getMaxValue();
284
-
285
-		$valid=true;
286
-		if($minValue!=='')
287
-			$valid=$valid && $this->isGreaterThan(strcmp($value,$minValue),0);
288
-		if($maxValue!=='')
289
-			$valid=$valid && $this->isLessThan(strcmp($value,$maxValue),0);
282
+		$minValue = $this->getMinValue();
283
+		$maxValue = $this->getMaxValue();
284
+
285
+		$valid = true;
286
+		if ($minValue !== '')
287
+			$valid = $valid && $this->isGreaterThan(strcmp($value, $minValue), 0);
288
+		if ($maxValue !== '')
289
+			$valid = $valid && $this->isLessThan(strcmp($value, $maxValue), 0);
290 290
 		return $valid;
291 291
 	}
292 292
 
@@ -296,24 +296,24 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	protected function isValidStringLength($value)
298 298
 	{
299
-		$minValue=$this->getMinValue();
300
-		$maxValue=$this->getMaxValue();
299
+		$minValue = $this->getMinValue();
300
+		$maxValue = $this->getMaxValue();
301 301
 
302
-		$valid=true;
302
+		$valid = true;
303 303
 		$charset = $this->getCharset();
304
-		if($charset==='')
304
+		if ($charset === '')
305 305
 		{
306
-			$app= $this->getApplication()->getGlobalization();
306
+			$app = $this->getApplication()->getGlobalization();
307 307
 			$charset = $app ? $app->getCharset() : null;
308
-			if(!$charset)
308
+			if (!$charset)
309 309
 				$charset = 'UTF-8';
310 310
 		}
311 311
 
312 312
 		$length = iconv_strlen($value, $charset);
313
-		if($minValue!=='')
314
-			$valid = $valid && $this->isGreaterThan($length,intval($minValue));
315
-		if($maxValue!=='')
316
-			$valid = $valid && $this->isLessThan($length,intval($maxValue));
313
+		if ($minValue !== '')
314
+			$valid = $valid && $this->isGreaterThan($length, intval($minValue));
315
+		if ($maxValue !== '')
316
+			$valid = $valid && $this->isLessThan($length, intval($maxValue));
317 317
 		return $valid;
318 318
 	}
319 319
 
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
 	 */
324 324
 	protected function getClientScriptOptions()
325 325
 	{
326
-		$options=parent::getClientScriptOptions();
327
-		$options['MinValue']=$this->getMinValue();
328
-		$options['MaxValue']=$this->getMaxValue();
329
-		$options['DataType']=$this->getDataType();
330
-		$options['StrictComparison']=$this->getStrictComparison();
331
-		if(($dateFormat=$this->getDateFormat())!=='')
332
-			$options['DateFormat']=$dateFormat;
326
+		$options = parent::getClientScriptOptions();
327
+		$options['MinValue'] = $this->getMinValue();
328
+		$options['MaxValue'] = $this->getMaxValue();
329
+		$options['DataType'] = $this->getDataType();
330
+		$options['StrictComparison'] = $this->getStrictComparison();
331
+		if (($dateFormat = $this->getDateFormat()) !== '')
332
+			$options['DateFormat'] = $dateFormat;
333 333
 		return $options;
334 334
 	}
335 335
 }
@@ -353,5 +353,5 @@  discard block
 block discarded – undo
353 353
  */
354 354
 class TRangeValidationDataType extends TValidationDataType
355 355
 {
356
-	const StringLength='StringLength';
356
+	const StringLength = 'StringLength';
357 357
 }
Please login to merge, or discard this patch.
Braces   +46 added lines, -32 removed lines patch added patch discarded remove patch
@@ -170,8 +170,9 @@  discard block
 block discarded – undo
170 170
 	protected function evaluateIsValid()
171 171
 	{
172 172
 		$value=$this->getValidationValue($this->getValidationTarget());
173
-		if($value==='')
174
-			return true;
173
+		if($value==='') {
174
+					return true;
175
+		}
175 176
 
176 177
 		switch($this->getDataType())
177 178
 		{
@@ -200,10 +201,12 @@  discard block
 block discarded – undo
200 201
 
201 202
 		$valid=preg_match('/^[-+]?[0-9]+$/',trim($value));
202 203
 		$value=intval($value);
203
-		if($minValue!=='')
204
-			$valid=$valid && $this->isGreaterThan($value, intval($minValue));
205
-		if($maxValue!=='')
206
-			$valid=$valid && $this->isLessThan($value,intval($maxValue));
204
+		if($minValue!=='') {
205
+					$valid=$valid && $this->isGreaterThan($value, intval($minValue));
206
+		}
207
+		if($maxValue!=='') {
208
+					$valid=$valid && $this->isLessThan($value,intval($maxValue));
209
+		}
207 210
 		return $valid;
208 211
 	}
209 212
 
@@ -229,10 +232,12 @@  discard block
 block discarded – undo
229 232
 
230 233
 		$valid=preg_match('/^[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?$/',trim($value));
231 234
 		$value=floatval($value);
232
-		if($minValue!=='')
233
-			$valid=$valid && $this->isGreaterThan($value,floatval($minValue));
234
-		if($maxValue!=='')
235
-			$valid=$valid && $this->isLessThan($value,floatval($maxValue));
235
+		if($minValue!=='') {
236
+					$valid=$valid && $this->isGreaterThan($value,floatval($minValue));
237
+		}
238
+		if($maxValue!=='') {
239
+					$valid=$valid && $this->isLessThan($value,floatval($maxValue));
240
+		}
236 241
 		return $valid;
237 242
 	}
238 243
 
@@ -254,19 +259,22 @@  discard block
 block discarded – undo
254 259
 		{
255 260
 			$formatter=Prado::createComponent('System.Util.TSimpleDateFormatter', $dateFormat);
256 261
 			$value = $formatter->parse($value);
257
-			if($minValue!=='')
258
-				$valid=$valid && $this->isGreaterThan($value,$formatter->parse($minValue));
259
-			if($maxValue!=='')
260
-				$valid=$valid && $this->isLessThan($value,$formatter->parse($maxValue));
262
+			if($minValue!=='') {
263
+							$valid=$valid && $this->isGreaterThan($value,$formatter->parse($minValue));
264
+			}
265
+			if($maxValue!=='') {
266
+							$valid=$valid && $this->isLessThan($value,$formatter->parse($maxValue));
267
+			}
261 268
 			return $valid;
262
-		}
263
-		else
269
+		} else
264 270
 		{
265 271
 			$value=strtotime($value);
266
-			if($minValue!=='')
267
-				$valid=$valid && $this->isGreaterThan($value,strtotime($minValue));
268
-			if($maxValue!=='')
269
-				$valid=$valid && $this->isLessThan($value,strtotime($maxValue));
272
+			if($minValue!=='') {
273
+							$valid=$valid && $this->isGreaterThan($value,strtotime($minValue));
274
+			}
275
+			if($maxValue!=='') {
276
+							$valid=$valid && $this->isLessThan($value,strtotime($maxValue));
277
+			}
270 278
 			return $valid;
271 279
 		}
272 280
 	}
@@ -283,10 +291,12 @@  discard block
 block discarded – undo
283 291
 		$maxValue=$this->getMaxValue();
284 292
 
285 293
 		$valid=true;
286
-		if($minValue!=='')
287
-			$valid=$valid && $this->isGreaterThan(strcmp($value,$minValue),0);
288
-		if($maxValue!=='')
289
-			$valid=$valid && $this->isLessThan(strcmp($value,$maxValue),0);
294
+		if($minValue!=='') {
295
+					$valid=$valid && $this->isGreaterThan(strcmp($value,$minValue),0);
296
+		}
297
+		if($maxValue!=='') {
298
+					$valid=$valid && $this->isLessThan(strcmp($value,$maxValue),0);
299
+		}
290 300
 		return $valid;
291 301
 	}
292 302
 
@@ -305,15 +315,18 @@  discard block
 block discarded – undo
305 315
 		{
306 316
 			$app= $this->getApplication()->getGlobalization();
307 317
 			$charset = $app ? $app->getCharset() : null;
308
-			if(!$charset)
309
-				$charset = 'UTF-8';
318
+			if(!$charset) {
319
+							$charset = 'UTF-8';
320
+			}
310 321
 		}
311 322
 
312 323
 		$length = iconv_strlen($value, $charset);
313
-		if($minValue!=='')
314
-			$valid = $valid && $this->isGreaterThan($length,intval($minValue));
315
-		if($maxValue!=='')
316
-			$valid = $valid && $this->isLessThan($length,intval($maxValue));
324
+		if($minValue!=='') {
325
+					$valid = $valid && $this->isGreaterThan($length,intval($minValue));
326
+		}
327
+		if($maxValue!=='') {
328
+					$valid = $valid && $this->isLessThan($length,intval($maxValue));
329
+		}
317 330
 		return $valid;
318 331
 	}
319 332
 
@@ -328,8 +341,9 @@  discard block
 block discarded – undo
328 341
 		$options['MaxValue']=$this->getMaxValue();
329 342
 		$options['DataType']=$this->getDataType();
330 343
 		$options['StrictComparison']=$this->getStrictComparison();
331
-		if(($dateFormat=$this->getDateFormat())!=='')
332
-			$options['DateFormat']=$dateFormat;
344
+		if(($dateFormat=$this->getDateFormat())!=='') {
345
+					$options['DateFormat']=$dateFormat;
346
+		}
333 347
 		return $options;
334 348
 	}
335 349
 }
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * TRangeValidator class file
4
- *
5
- * @author Qiang Xue <[email protected]>
6
- * @link https://github.com/pradosoft/prado
7
- * @copyright Copyright &copy; 2005-2015 The PRADO Group
8
- * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
- * @package System.Web.UI.WebControls
10
- */
3
+	 * TRangeValidator class file
4
+	 *
5
+	 * @author Qiang Xue <[email protected]>
6
+	 * @link https://github.com/pradosoft/prado
7
+	 * @copyright Copyright &copy; 2005-2015 The PRADO Group
8
+	 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9
+	 * @package System.Web.UI.WebControls
10
+	 */
11 11
 
12 12
 /**
13 13
  * Using TBaseValidator class
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	/**
132
-     * Sets the date format for a date validation
133
-     * @param string the date format value
134
-     */
132
+	 * Sets the date format for a date validation
133
+	 * @param string the date format value
134
+	 */
135 135
 	public function setDateFormat($value)
136 136
 	{
137 137
 		$this->setViewState('DateFormat', $value, '');
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 
191 191
 	/**
192
-	* Determine if the value is within the integer range.
193
-	* @param string value to validate true
194
-	* @return boolean true if within integer range.
195
-	*/
192
+	 * Determine if the value is within the integer range.
193
+	 * @param string value to validate true
194
+	 * @return boolean true if within integer range.
195
+	 */
196 196
 	protected function isValidInteger($value)
197 197
 	{
198 198
 		$minValue=$this->getMinValue();
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TRatingList.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -132,6 +132,7 @@
 block discarded – undo
132 132
 
133 133
 	/**
134 134
 	 * @param float rating value
135
+	 * @param double $rating
135 136
 	 * @return int rating as integer
136 137
 	 */
137 138
 	protected function getRatingIndex($rating)
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
  	}
216 216
 
217 217
  	/**
218
-	 * @return string rating style css class name.
218
+ 	 * @return string rating style css class name.
219 219
  	 */
220 220
 	protected function getRatingStyleCssClass()
221 221
  	{
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
  	}
259 259
 
260 260
  	/**
261
-	 * @return string find the client ID of the caption control.
261
+ 	 * @return string find the client ID of the caption control.
262 262
  	 */
263 263
 	protected function getCaptionControlID()
264 264
  	{
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	/**
30 30
 	 * Script path relative to the TClientScriptManager::SCRIPT_PATH
31 31
 	 */
32
-	const SCRIPT_PATH='prado/ratings';
32
+	const SCRIPT_PATH = 'prado/ratings';
33 33
 
34 34
 	/**
35 35
 	 * @var array list of published rating images.
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	public function getReadOnly()
52 52
 	{
53
-		return $this->getViewState('ReadOnly',false);
53
+		return $this->getViewState('ReadOnly', false);
54 54
 	}
55 55
 
56 56
 	/**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function setReadOnly($value)
60 60
 	{
61
-		$this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false);
61
+		$this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false);
62 62
 	}
63 63
 
64 64
 	/**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function setRepeatLayout($value)
97 97
 	{
98
-		if($value!==TRepeatLayout::Table)
98
+		if ($value !== TRepeatLayout::Table)
99 99
 			throw new TInvalidDataValueException('ratinglist_table_layout_only');
100 100
 		else
101 101
 			parent::setRepeatLayout($value);
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	{
109 109
 		$rating = $this->getViewState('Rating', null);
110 110
 		if ($rating === null)
111
-			return $this->getSelectedIndex()+1;
111
+			return $this->getSelectedIndex() + 1;
112 112
 		else
113 113
 			return $rating;
114 114
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 	public function setSelectedIndex($value)
128 128
 	{
129
-		$this->setRating($value+1);
129
+		$this->setRating($value + 1);
130 130
 		parent::setSelectedIndex($value);
131 131
 	}
132 132
 
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 	protected function getRatingIndex($rating)
138 138
 	{
139 139
 		$interval = $this->getHalfRatingInterval();
140
-		$base = intval($rating)-1;
141
-		$remainder = $rating-$base-1;
142
-		return $remainder > $interval[1] ? $base+1 : $base;
140
+		$base = intval($rating) - 1;
141
+		$remainder = $rating - $base - 1;
142
+		return $remainder > $interval[1] ? $base + 1 : $base;
143 143
 	}
144 144
 
145 145
 	/**
@@ -171,15 +171,15 @@  discard block
 block discarded – undo
171 171
 
172 172
 	protected function getCaptionControl()
173 173
 	{
174
-		if(($id=$this->getCaptionID())!=='')
174
+		if (($id = $this->getCaptionID()) !== '')
175 175
 		{
176
-			if($control=$this->getPage()->findControl($id))
176
+			if ($control = $this->getPage()->findControl($id))
177 177
 				return $control;
178
-			if($control=$this->getNamingContainer()->findControl($id))
178
+			if ($control = $this->getNamingContainer()->findControl($id))
179 179
 				return $control;
180 180
 		}
181 181
 		throw new TInvalidDataValueException(
182
-			'ratinglist_invalid_caption_id',$id,$this->getID());
182
+			'ratinglist_invalid_caption_id', $id, $this->getID());
183 183
 	}
184 184
 
185 185
 	/**
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
  	 */
220 220
 	protected function getRatingStyleCssClass()
221 221
  	{
222
-		return 'TRatingList_'.$this->getRatingStyle();
222
+		return 'TRatingList_' . $this->getRatingStyle();
223 223
  	}
224 224
 
225 225
 	/**
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
  	 */
263 263
 	protected function getCaptionControlID()
264 264
  	{
265
-		if(($id=$this->getCaptionID())!=='')
265
+		if (($id = $this->getCaptionID()) !== '')
266 266
  		{
267
-			if($control=$this->getParent()->findControl($id))
267
+			if ($control = $this->getParent()->findControl($id))
268 268
 			{
269
-				if($control->getVisible(true))
269
+				if ($control->getVisible(true))
270 270
 					return $control->getClientID();
271 271
 			}
272 272
 			else
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 	protected function publishStyle($style)
294 294
  	{
295 295
 		$cs = $this->getPage()->getClientScript();
296
-		$url = $this->getAssetUrl($style.'.css');
297
-		if(!$cs->isStyleSheetFileRegistered($url))
296
+		$url = $this->getAssetUrl($style . '.css');
297
+		if (!$cs->isStyleSheetFileRegistered($url))
298 298
 			$cs->registerStyleSheetFile($url, $url);
299 299
 		return $url;
300 300
  	}
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
 	 * @param string rating image file extension, default is '.gif'
305 305
 	 * @return array URL of publish the rating images
306 306
 	 */
307
-	protected function publishImages($style, $fileExt='.gif')
307
+	protected function publishImages($style, $fileExt = '.gif')
308 308
  	{
309 309
 		$types = array('blank', 'selected', 'half', 'combined');
310 310
 		$files = array();
311
-		foreach($types as $type)
311
+		foreach ($types as $type)
312 312
 			$files[$type] = $this->getAssetUrl("{$style}_{$type}{$fileExt}");
313 313
 		return $files;
314 314
  	}
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	protected function registerClientScript()
320 320
 	{
321
-		$cs=$this->getPage()->getClientScript();
321
+		$cs = $this->getPage()->getClientScript();
322 322
 		$cs->registerPradoScript('ratings');
323 323
 	}
324 324
 
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
 	 * @param string asset file in the self::SCRIPT_PATH directory.
327 327
 	 * @return string asset file url.
328 328
 	 */
329
-	protected function getAssetUrl($file='')
329
+	protected function getAssetUrl($file = '')
330 330
  	{
331 331
 		$base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl();
332
-		return $base.'/'.self::SCRIPT_PATH.'/'.$file;
332
+		return $base . '/' . self::SCRIPT_PATH . '/' . $file;
333 333
  	}
334 334
 
335 335
 	/**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	public function render($writer)
342 342
  	{
343
-		$writer->addAttribute('id',$this->getClientID());
343
+		$writer->addAttribute('id', $this->getClientID());
344 344
 		$this->getPage()->getClientScript()->registerPostBackControl(
345 345
 			$this->getClientClassName(), $this->getPostBackOptions());
346 346
 		parent::render($writer);
Please login to merge, or discard this patch.
Braces   +27 added lines, -20 removed lines patch added patch discarded remove patch
@@ -95,10 +95,11 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function setRepeatLayout($value)
97 97
 	{
98
-		if($value!==TRepeatLayout::Table)
99
-			throw new TInvalidDataValueException('ratinglist_table_layout_only');
100
-		else
101
-			parent::setRepeatLayout($value);
98
+		if($value!==TRepeatLayout::Table) {
99
+					throw new TInvalidDataValueException('ratinglist_table_layout_only');
100
+		} else {
101
+					parent::setRepeatLayout($value);
102
+		}
102 103
 	}
103 104
 
104 105
 	/**
@@ -107,10 +108,11 @@  discard block
 block discarded – undo
107 108
 	public function getRating()
108 109
 	{
109 110
 		$rating = $this->getViewState('Rating', null);
110
-		if ($rating === null)
111
-			return $this->getSelectedIndex()+1;
112
-		else
113
-			return $rating;
111
+		if ($rating === null) {
112
+					return $this->getSelectedIndex()+1;
113
+		} else {
114
+					return $rating;
115
+		}
114 116
 	}
115 117
 
116 118
 	/**
@@ -173,10 +175,12 @@  discard block
 block discarded – undo
173 175
 	{
174 176
 		if(($id=$this->getCaptionID())!=='')
175 177
 		{
176
-			if($control=$this->getPage()->findControl($id))
177
-				return $control;
178
-			if($control=$this->getNamingContainer()->findControl($id))
179
-				return $control;
178
+			if($control=$this->getPage()->findControl($id)) {
179
+							return $control;
180
+			}
181
+			if($control=$this->getNamingContainer()->findControl($id)) {
182
+							return $control;
183
+			}
180 184
 		}
181 185
 		throw new TInvalidDataValueException(
182 186
 			'ratinglist_invalid_caption_id',$id,$this->getID());
@@ -266,11 +270,12 @@  discard block
 block discarded – undo
266 270
  		{
267 271
 			if($control=$this->getParent()->findControl($id))
268 272
 			{
269
-				if($control->getVisible(true))
270
-					return $control->getClientID();
273
+				if($control->getVisible(true)) {
274
+									return $control->getClientID();
275
+				}
276
+			} else {
277
+							return $id;
271 278
 			}
272
-			else
273
-				return $id;
274 279
  		}
275 280
 		return '';
276 281
  	}
@@ -294,8 +299,9 @@  discard block
 block discarded – undo
294 299
  	{
295 300
 		$cs = $this->getPage()->getClientScript();
296 301
 		$url = $this->getAssetUrl($style.'.css');
297
-		if(!$cs->isStyleSheetFileRegistered($url))
298
-			$cs->registerStyleSheetFile($url, $url);
302
+		if(!$cs->isStyleSheetFileRegistered($url)) {
303
+					$cs->registerStyleSheetFile($url, $url);
304
+		}
299 305
 		return $url;
300 306
  	}
301 307
 
@@ -308,8 +314,9 @@  discard block
 block discarded – undo
308 314
  	{
309 315
 		$types = array('blank', 'selected', 'half', 'combined');
310 316
 		$files = array();
311
-		foreach($types as $type)
312
-			$files[$type] = $this->getAssetUrl("{$style}_{$type}{$fileExt}");
317
+		foreach($types as $type) {
318
+					$files[$type] = $this->getAssetUrl("{$style}_{$type}{$fileExt}");
319
+		}
313 320
 		return $files;
314 321
  	}
315 322
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TRepeater.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -464,6 +464,7 @@  discard block
 block discarded – undo
464 464
 	 * This method invokes {@link createItem} to create a new repeater item.
465 465
 	 * @param integer zero-based item index.
466 466
 	 * @param TListItemType item type
467
+	 * @param integer $itemIndex
467 468
 	 * @return TControl the created item, null if item is not created
468 469
 	 */
469 470
 	private function createItemInternal($itemIndex,$itemType)
@@ -485,6 +486,7 @@  discard block
 block discarded – undo
485 486
 	 * @param integer zero-based item index.
486 487
 	 * @param TListItemType item type
487 488
 	 * @param mixed data to be associated with the item
489
+	 * @param integer $itemIndex
488 490
 	 * @return TControl the created item, null if item is not created
489 491
 	 */
490 492
 	private function createItemWithDataInternal($itemIndex,$itemType,$dataItem)
@@ -718,6 +720,7 @@  discard block
 block discarded – undo
718 720
 	 * If you override this method, be sure to call parent's implementation
719 721
 	 * so that event handlers have chance to respond to the event.
720 722
 	 * @param TRepeaterItemEventParameter event parameter
723
+	 * @param TRepeaterItemEventParameter $param
721 724
 	 */
722 725
 	public function onItemCreated($param)
723 726
 	{
@@ -732,6 +735,7 @@  discard block
 block discarded – undo
732 735
 	 * If you override this method, be sure to call parent's implementation
733 736
 	 * so that event handlers have chance to respond to the event.
734 737
 	 * @param TRepeaterItemEventParameter event parameter
738
+	 * @param TRepeaterItemEventParameter $param
735 739
 	 */
736 740
 	public function onItemDataBound($param)
737 741
 	{
@@ -751,6 +755,7 @@  discard block
 block discarded – undo
751 755
 	 * Be sure to call parent's implementation so that
752 756
 	 * event handlers have chance to respond to the event.
753 757
 	 * @param TRepeaterCommandEventParameter event parameter
758
+	 * @param TRepeaterCommandEventParameter $param
754 759
 	 */
755 760
 	public function onItemCommand($param)
756 761
 	{
@@ -765,6 +770,7 @@  discard block
 block discarded – undo
765 770
 	 * Otherwise, an exception will be raised.
766 771
 	 * @param mixed data item
767 772
 	 * @param mixed field name
773
+	 * @param string $field
768 774
 	 * @return mixed data value at the specified field
769 775
 	 * @throws TInvalidDataValueException if the data is invalid
770 776
 	 */
@@ -796,6 +802,7 @@  discard block
 block discarded – undo
796 802
 	/**
797 803
 	 * Constructor.
798 804
 	 * @param TControl repeater item related with the corresponding event
805
+	 * @param TControl $item
799 806
 	 */
800 807
 	public function __construct($item)
801 808
 	{
Please login to merge, or discard this patch.
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -95,48 +95,48 @@  discard block
 block discarded – undo
95 95
 	 * Repeater item types
96 96
 	 * @deprecated deprecated since version 3.0.4. Use TListItemType constants instead.
97 97
 	 */
98
-	const IT_HEADER='Header';
99
-	const IT_FOOTER='Footer';
100
-	const IT_ITEM='Item';
101
-	const IT_SEPARATOR='Separator';
102
-	const IT_ALTERNATINGITEM='AlternatingItem';
98
+	const IT_HEADER = 'Header';
99
+	const IT_FOOTER = 'Footer';
100
+	const IT_ITEM = 'Item';
101
+	const IT_SEPARATOR = 'Separator';
102
+	const IT_ALTERNATINGITEM = 'AlternatingItem';
103 103
 
104 104
 	/**
105 105
 	 * @var ITemplate template for repeater items
106 106
 	 */
107
-	private $_itemTemplate=null;
107
+	private $_itemTemplate = null;
108 108
 	/**
109 109
 	 * @var ITemplate template for each alternating item
110 110
 	 */
111
-	private $_alternatingItemTemplate=null;
111
+	private $_alternatingItemTemplate = null;
112 112
 	/**
113 113
 	 * @var ITemplate template for header
114 114
 	 */
115
-	private $_headerTemplate=null;
115
+	private $_headerTemplate = null;
116 116
 	/**
117 117
 	 * @var ITemplate template for footer
118 118
 	 */
119
-	private $_footerTemplate=null;
119
+	private $_footerTemplate = null;
120 120
 	/**
121 121
 	 * @var ITemplate template used for repeater when no data is bound
122 122
 	 */
123
-	private $_emptyTemplate=null;
123
+	private $_emptyTemplate = null;
124 124
 	/**
125 125
 	 * @var ITemplate template for separator
126 126
 	 */
127
-	private $_separatorTemplate=null;
127
+	private $_separatorTemplate = null;
128 128
 	/**
129 129
 	 * @var TRepeaterItemCollection list of repeater items
130 130
 	 */
131
-	private $_items=null;
131
+	private $_items = null;
132 132
 	/**
133 133
 	 * @var TControl header item
134 134
 	 */
135
-	private $_header=null;
135
+	private $_header = null;
136 136
 	/**
137 137
 	 * @var TControl footer item
138 138
 	 */
139
-	private $_footer=null;
139
+	private $_footer = null;
140 140
 
141 141
 
142 142
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	public function getItemRenderer()
147 147
 	{
148
-		return $this->getViewState('ItemRenderer','');
148
+		return $this->getViewState('ItemRenderer', '');
149 149
 	}
150 150
 
151 151
 	/**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function setItemRenderer($value)
162 162
 	{
163
-		$this->setViewState('ItemRenderer',$value,'');
163
+		$this->setViewState('ItemRenderer', $value, '');
164 164
 	}
165 165
 
166 166
 	/**
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	public function getAlternatingItemRenderer()
171 171
 	{
172
-		return $this->getViewState('AlternatingItemRenderer','');
172
+		return $this->getViewState('AlternatingItemRenderer', '');
173 173
 	}
174 174
 
175 175
 	/**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public function setAlternatingItemRenderer($value)
186 186
 	{
187
-		$this->setViewState('AlternatingItemRenderer',$value,'');
187
+		$this->setViewState('AlternatingItemRenderer', $value, '');
188 188
 	}
189 189
 
190 190
 	/**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public function getSeparatorRenderer()
195 195
 	{
196
-		return $this->getViewState('SeparatorRenderer','');
196
+		return $this->getViewState('SeparatorRenderer', '');
197 197
 	}
198 198
 
199 199
 	/**
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	public function setSeparatorRenderer($value)
210 210
 	{
211
-		$this->setViewState('SeparatorRenderer',$value,'');
211
+		$this->setViewState('SeparatorRenderer', $value, '');
212 212
 	}
213 213
 
214 214
 	/**
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	public function getHeaderRenderer()
219 219
 	{
220
-		return $this->getViewState('HeaderRenderer','');
220
+		return $this->getViewState('HeaderRenderer', '');
221 221
 	}
222 222
 
223 223
 	/**
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 */
233 233
 	public function setHeaderRenderer($value)
234 234
 	{
235
-		$this->setViewState('HeaderRenderer',$value,'');
235
+		$this->setViewState('HeaderRenderer', $value, '');
236 236
 	}
237 237
 
238 238
 	/**
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public function getFooterRenderer()
243 243
 	{
244
-		return $this->getViewState('FooterRenderer','');
244
+		return $this->getViewState('FooterRenderer', '');
245 245
 	}
246 246
 
247 247
 	/**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	public function setFooterRenderer($value)
258 258
 	{
259
-		$this->setViewState('FooterRenderer',$value,'');
259
+		$this->setViewState('FooterRenderer', $value, '');
260 260
 	}
261 261
 
262 262
 	/**
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	public function getEmptyRenderer()
267 267
 	{
268
-		return $this->getViewState('EmptyRenderer','');
268
+		return $this->getViewState('EmptyRenderer', '');
269 269
 	}
270 270
 
271 271
 	/**
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public function setEmptyRenderer($value)
283 283
 	{
284
-		$this->setViewState('EmptyRenderer',$value,'');
284
+		$this->setViewState('EmptyRenderer', $value, '');
285 285
 	}
286 286
 
287 287
 	/**
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 	 */
299 299
 	public function setItemTemplate($value)
300 300
 	{
301
-		if($value instanceof ITemplate || $value===null)
302
-			$this->_itemTemplate=$value;
301
+		if ($value instanceof ITemplate || $value === null)
302
+			$this->_itemTemplate = $value;
303 303
 		else
304
-			throw new TInvalidDataTypeException('repeater_template_required','ItemTemplate');
304
+			throw new TInvalidDataTypeException('repeater_template_required', 'ItemTemplate');
305 305
 	}
306 306
 
307 307
 	/**
@@ -318,10 +318,10 @@  discard block
 block discarded – undo
318 318
 	 */
319 319
 	public function setAlternatingItemTemplate($value)
320 320
 	{
321
-		if($value instanceof ITemplate || $value===null)
322
-			$this->_alternatingItemTemplate=$value;
321
+		if ($value instanceof ITemplate || $value === null)
322
+			$this->_alternatingItemTemplate = $value;
323 323
 		else
324
-			throw new TInvalidDataTypeException('repeater_template_required','AlternatingItemTemplate');
324
+			throw new TInvalidDataTypeException('repeater_template_required', 'AlternatingItemTemplate');
325 325
 	}
326 326
 
327 327
 	/**
@@ -338,10 +338,10 @@  discard block
 block discarded – undo
338 338
 	 */
339 339
 	public function setHeaderTemplate($value)
340 340
 	{
341
-		if($value instanceof ITemplate || $value===null)
342
-			$this->_headerTemplate=$value;
341
+		if ($value instanceof ITemplate || $value === null)
342
+			$this->_headerTemplate = $value;
343 343
 		else
344
-			throw new TInvalidDataTypeException('repeater_template_required','HeaderTemplate');
344
+			throw new TInvalidDataTypeException('repeater_template_required', 'HeaderTemplate');
345 345
 	}
346 346
 
347 347
 	/**
@@ -358,10 +358,10 @@  discard block
 block discarded – undo
358 358
 	 */
359 359
 	public function setFooterTemplate($value)
360 360
 	{
361
-		if($value instanceof ITemplate || $value===null)
362
-			$this->_footerTemplate=$value;
361
+		if ($value instanceof ITemplate || $value === null)
362
+			$this->_footerTemplate = $value;
363 363
 		else
364
-			throw new TInvalidDataTypeException('repeater_template_required','FooterTemplate');
364
+			throw new TInvalidDataTypeException('repeater_template_required', 'FooterTemplate');
365 365
 	}
366 366
 
367 367
 	/**
@@ -378,10 +378,10 @@  discard block
 block discarded – undo
378 378
 	 */
379 379
 	public function setEmptyTemplate($value)
380 380
 	{
381
-		if($value instanceof ITemplate || $value===null)
382
-			$this->_emptyTemplate=$value;
381
+		if ($value instanceof ITemplate || $value === null)
382
+			$this->_emptyTemplate = $value;
383 383
 		else
384
-			throw new TInvalidDataTypeException('repeater_template_required','EmptyTemplate');
384
+			throw new TInvalidDataTypeException('repeater_template_required', 'EmptyTemplate');
385 385
 	}
386 386
 
387 387
 	/**
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	public function setSeparatorTemplate($value)
400 400
 	{
401
-		if($value instanceof ITemplate || $value===null)
402
-			$this->_separatorTemplate=$value;
401
+		if ($value instanceof ITemplate || $value === null)
402
+			$this->_separatorTemplate = $value;
403 403
 		else
404
-			throw new TInvalidDataTypeException('repeater_template_required','SeparatorTemplate');
404
+			throw new TInvalidDataTypeException('repeater_template_required', 'SeparatorTemplate');
405 405
 	}
406 406
 
407 407
 	/**
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
 	 */
426 426
 	public function getItems()
427 427
 	{
428
-		if(!$this->_items)
429
-			$this->_items=new TRepeaterItemCollection;
428
+		if (!$this->_items)
429
+			$this->_items = new TRepeaterItemCollection;
430 430
 		return $this->_items;
431 431
 	}
432 432
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	 */
436 436
 	public function getDataKeyField()
437 437
 	{
438
-		return $this->getViewState('DataKeyField','');
438
+		return $this->getViewState('DataKeyField', '');
439 439
 	}
440 440
 
441 441
 	/**
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	 */
444 444
 	public function setDataKeyField($value)
445 445
 	{
446
-		$this->setViewState('DataKeyField',$value,'');
446
+		$this->setViewState('DataKeyField', $value, '');
447 447
 	}
448 448
 
449 449
 	/**
@@ -451,10 +451,10 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	public function getDataKeys()
453 453
 	{
454
-		if(($dataKeys=$this->getViewState('DataKeys',null))===null)
454
+		if (($dataKeys = $this->getViewState('DataKeys', null)) === null)
455 455
 		{
456
-			$dataKeys=new TList;
457
-			$this->setViewState('DataKeys',$dataKeys,null);
456
+			$dataKeys = new TList;
457
+			$this->setViewState('DataKeys', $dataKeys, null);
458 458
 		}
459 459
 		return $dataKeys;
460 460
 	}
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
 	 * @param TListItemType item type
467 467
 	 * @return TControl the created item, null if item is not created
468 468
 	 */
469
-	private function createItemInternal($itemIndex,$itemType)
469
+	private function createItemInternal($itemIndex, $itemType)
470 470
 	{
471
-		if(($item=$this->createItem($itemIndex,$itemType))!==null)
471
+		if (($item = $this->createItem($itemIndex, $itemType)) !== null)
472 472
 		{
473
-			$param=new TRepeaterItemEventParameter($item);
473
+			$param = new TRepeaterItemEventParameter($item);
474 474
 			$this->onItemCreated($param);
475 475
 			$this->getControls()->add($item);
476 476
 			return $item;
@@ -487,12 +487,12 @@  discard block
 block discarded – undo
487 487
 	 * @param mixed data to be associated with the item
488 488
 	 * @return TControl the created item, null if item is not created
489 489
 	 */
490
-	private function createItemWithDataInternal($itemIndex,$itemType,$dataItem)
490
+	private function createItemWithDataInternal($itemIndex, $itemType, $dataItem)
491 491
 	{
492
-		if(($item=$this->createItem($itemIndex,$itemType))!==null)
492
+		if (($item = $this->createItem($itemIndex, $itemType)) !== null)
493 493
 		{
494
-			$param=new TRepeaterItemEventParameter($item);
495
-			if($item instanceof IDataRenderer)
494
+			$param = new TRepeaterItemEventParameter($item);
495
+			if ($item instanceof IDataRenderer)
496 496
 				$item->setData($dataItem);
497 497
 			$this->onItemCreated($param);
498 498
 			$this->getControls()->add($item);
@@ -510,56 +510,56 @@  discard block
 block discarded – undo
510 510
 	 * @param TListItemType item type
511 511
 	 * @return TControl created repeater item
512 512
 	 */
513
-	protected function createItem($itemIndex,$itemType)
513
+	protected function createItem($itemIndex, $itemType)
514 514
 	{
515
-		$template=null;
516
-		$classPath=null;
517
-		switch($itemType)
515
+		$template = null;
516
+		$classPath = null;
517
+		switch ($itemType)
518 518
 		{
519 519
 			case TListItemType::Item :
520
-				$classPath=$this->getItemRenderer();
521
-				$template=$this->_itemTemplate;
520
+				$classPath = $this->getItemRenderer();
521
+				$template = $this->_itemTemplate;
522 522
 				break;
523 523
 			case TListItemType::AlternatingItem :
524
-				if(($classPath=$this->getAlternatingItemRenderer())==='' && ($template=$this->_alternatingItemTemplate)===null)
524
+				if (($classPath = $this->getAlternatingItemRenderer()) === '' && ($template = $this->_alternatingItemTemplate) === null)
525 525
 				{
526
-					$classPath=$this->getItemRenderer();
527
-					$template=$this->_itemTemplate;
526
+					$classPath = $this->getItemRenderer();
527
+					$template = $this->_itemTemplate;
528 528
 				}
529 529
 				break;
530 530
 			case TListItemType::Header :
531
-				$classPath=$this->getHeaderRenderer();
532
-				$template=$this->_headerTemplate;
531
+				$classPath = $this->getHeaderRenderer();
532
+				$template = $this->_headerTemplate;
533 533
 				break;
534 534
 			case TListItemType::Footer :
535
-				$classPath=$this->getFooterRenderer();
536
-				$template=$this->_footerTemplate;
535
+				$classPath = $this->getFooterRenderer();
536
+				$template = $this->_footerTemplate;
537 537
 				break;
538 538
 			case TListItemType::Separator :
539
-				$classPath=$this->getSeparatorRenderer();
540
-				$template=$this->_separatorTemplate;
539
+				$classPath = $this->getSeparatorRenderer();
540
+				$template = $this->_separatorTemplate;
541 541
 				break;
542 542
 			default:
543
-				throw new TInvalidDataValueException('repeater_itemtype_unknown',$itemType);
543
+				throw new TInvalidDataValueException('repeater_itemtype_unknown', $itemType);
544 544
 		}
545
-		if($classPath!=='')
545
+		if ($classPath !== '')
546 546
 		{
547
-			$item=Prado::createComponent($classPath);
548
-			if($item instanceof IItemDataRenderer)
547
+			$item = Prado::createComponent($classPath);
548
+			if ($item instanceof IItemDataRenderer)
549 549
 			{
550 550
 				$item->setItemIndex($itemIndex);
551 551
 				$item->setItemType($itemType);
552 552
 			}
553 553
 		}
554
-		else if($template!==null)
554
+		else if ($template !== null)
555 555
 		{
556
-			$item=new TRepeaterItem;
556
+			$item = new TRepeaterItem;
557 557
 			$item->setItemIndex($itemIndex);
558 558
 			$item->setItemType($itemType);
559 559
 			$template->instantiateIn($item);
560 560
 		}
561 561
 		else
562
-			$item=null;
562
+			$item = null;
563 563
 
564 564
 		return $item;
565 565
 	}
@@ -569,9 +569,9 @@  discard block
 block discarded – undo
569 569
 	 */
570 570
 	protected function createEmptyContent()
571 571
 	{
572
-		if(($classPath=$this->getEmptyRenderer())!=='')
572
+		if (($classPath = $this->getEmptyRenderer()) !== '')
573 573
 			$this->getControls()->add(Prado::createComponent($classPath));
574
-		else if($this->_emptyTemplate!==null)
574
+		else if ($this->_emptyTemplate !== null)
575 575
 			$this->_emptyTemplate->instantiateIn($this);
576 576
 	}
577 577
 
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 	 */
584 584
 	public function render($writer)
585 585
 	{
586
-		if($this->_items && $this->_items->getCount() || $this->_emptyTemplate!==null || $this->getEmptyRenderer()!=='')
586
+		if ($this->_items && $this->_items->getCount() || $this->_emptyTemplate !== null || $this->getEmptyRenderer() !== '')
587 587
 			$this->renderContents($writer);
588 588
 	}
589 589
 
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
 	public function saveState()
595 595
 	{
596 596
 		parent::saveState();
597
-		if($this->_items)
598
-			$this->setViewState('ItemCount',$this->_items->getCount(),0);
597
+		if ($this->_items)
598
+			$this->setViewState('ItemCount', $this->_items->getCount(), 0);
599 599
 		else
600 600
 			$this->clearViewState('ItemCount');
601 601
 	}
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	public function loadState()
608 608
 	{
609 609
 		parent::loadState();
610
-		if(!$this->getIsDataBound())
610
+		if (!$this->getIsDataBound())
611 611
 			$this->restoreItemsFromViewState();
612 612
 		$this->clearViewState('ItemCount');
613 613
 	}
@@ -619,8 +619,8 @@  discard block
 block discarded – undo
619 619
 	{
620 620
 		$this->getControls()->clear();
621 621
 		$this->getItems()->clear();
622
-		$this->_header=null;
623
-		$this->_footer=null;
622
+		$this->_header = null;
623
+		$this->_footer = null;
624 624
 	}
625 625
 
626 626
 	/**
@@ -629,19 +629,19 @@  discard block
 block discarded – undo
629 629
 	protected function restoreItemsFromViewState()
630 630
 	{
631 631
 		$this->reset();
632
-		if(($itemCount=$this->getViewState('ItemCount',0))>0)
632
+		if (($itemCount = $this->getViewState('ItemCount', 0)) > 0)
633 633
 		{
634
-			$items=$this->getItems();
635
-			$hasSeparator=$this->_separatorTemplate!==null || $this->getSeparatorRenderer()!=='';
636
-			$this->_header=$this->createItemInternal(-1,TListItemType::Header);
637
-			for($i=0;$i<$itemCount;++$i)
634
+			$items = $this->getItems();
635
+			$hasSeparator = $this->_separatorTemplate !== null || $this->getSeparatorRenderer() !== '';
636
+			$this->_header = $this->createItemInternal(-1, TListItemType::Header);
637
+			for ($i = 0; $i < $itemCount; ++$i)
638 638
 			{
639
-				if($hasSeparator && $i>0)
640
-					$this->createItemInternal($i-1,TListItemType::Separator);
641
-				$itemType=$i%2==0?TListItemType::Item : TListItemType::AlternatingItem;
642
-				$items->add($this->createItemInternal($i,$itemType,false,null));
639
+				if ($hasSeparator && $i > 0)
640
+					$this->createItemInternal($i - 1, TListItemType::Separator);
641
+				$itemType = $i % 2 == 0 ? TListItemType::Item : TListItemType::AlternatingItem;
642
+				$items->add($this->createItemInternal($i, $itemType, false, null));
643 643
 			}
644
-			$this->_footer=$this->createItemInternal(-1,TListItemType::Footer);
644
+			$this->_footer = $this->createItemInternal(-1, TListItemType::Footer);
645 645
 		}
646 646
 		else
647 647
 			$this->createEmptyContent();
@@ -658,35 +658,35 @@  discard block
 block discarded – undo
658 658
 	{
659 659
 		$this->reset();
660 660
 
661
-		$keys=$this->getDataKeys();
661
+		$keys = $this->getDataKeys();
662 662
 		$keys->clear();
663
-		$keyField=$this->getDataKeyField();
663
+		$keyField = $this->getDataKeyField();
664 664
 
665
-		$items=$this->getItems();
666
-		$itemIndex=0;
667
-		$hasSeparator=$this->_separatorTemplate!==null || $this->getSeparatorRenderer()!=='';
668
-		foreach($data as $key=>$dataItem)
665
+		$items = $this->getItems();
666
+		$itemIndex = 0;
667
+		$hasSeparator = $this->_separatorTemplate !== null || $this->getSeparatorRenderer() !== '';
668
+		foreach ($data as $key=>$dataItem)
669 669
 		{
670
-			if($keyField!=='')
671
-				$keys->add($this->getDataFieldValue($dataItem,$keyField));
670
+			if ($keyField !== '')
671
+				$keys->add($this->getDataFieldValue($dataItem, $keyField));
672 672
 			else
673 673
 				$keys->add($key);
674
-			if($itemIndex===0)
675
-				$this->_header=$this->createItemWithDataInternal(-1,TListItemType::Header,null);
676
-			if($hasSeparator && $itemIndex>0)
677
-				$this->createItemWithDataInternal($itemIndex-1,TListItemType::Separator,null);
678
-			$itemType=$itemIndex%2==0?TListItemType::Item : TListItemType::AlternatingItem;
679
-			$items->add($this->createItemWithDataInternal($itemIndex,$itemType,$dataItem));
674
+			if ($itemIndex === 0)
675
+				$this->_header = $this->createItemWithDataInternal(-1, TListItemType::Header, null);
676
+			if ($hasSeparator && $itemIndex > 0)
677
+				$this->createItemWithDataInternal($itemIndex - 1, TListItemType::Separator, null);
678
+			$itemType = $itemIndex % 2 == 0 ? TListItemType::Item : TListItemType::AlternatingItem;
679
+			$items->add($this->createItemWithDataInternal($itemIndex, $itemType, $dataItem));
680 680
 			$itemIndex++;
681 681
 		}
682
-		if($itemIndex>0)
683
-			$this->_footer=$this->createItemWithDataInternal(-1,TListItemType::Footer,null);
682
+		if ($itemIndex > 0)
683
+			$this->_footer = $this->createItemWithDataInternal(-1, TListItemType::Footer, null);
684 684
 		else
685 685
 		{
686 686
 			$this->createEmptyContent();
687 687
 			$this->dataBindChildren();
688 688
 		}
689
-		$this->setViewState('ItemCount',$itemIndex,0);
689
+		$this->setViewState('ItemCount', $itemIndex, 0);
690 690
 	}
691 691
 
692 692
 	/**
@@ -698,9 +698,9 @@  discard block
 block discarded – undo
698 698
 	 * @param TEventParameter event parameter
699 699
 	 * @return boolean whether the event bubbling should stop here.
700 700
 	 */
701
-	public function bubbleEvent($sender,$param)
701
+	public function bubbleEvent($sender, $param)
702 702
 	{
703
-		if($param instanceof TRepeaterCommandEventParameter)
703
+		if ($param instanceof TRepeaterCommandEventParameter)
704 704
 		{
705 705
 			$this->onItemCommand($param);
706 706
 			return true;
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 	 */
722 722
 	public function onItemCreated($param)
723 723
 	{
724
-		$this->raiseEvent('OnItemCreated',$this,$param);
724
+		$this->raiseEvent('OnItemCreated', $this, $param);
725 725
 	}
726 726
 
727 727
 	/**
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 	 */
736 736
 	public function onItemDataBound($param)
737 737
 	{
738
-		$this->raiseEvent('OnItemDataBound',$this,$param);
738
+		$this->raiseEvent('OnItemDataBound', $this, $param);
739 739
 	}
740 740
 
741 741
 	/**
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 	 */
755 755
 	public function onItemCommand($param)
756 756
 	{
757
-		$this->raiseEvent('OnItemCommand',$this,$param);
757
+		$this->raiseEvent('OnItemCommand', $this, $param);
758 758
 	}
759 759
 
760 760
 	/**
@@ -768,9 +768,9 @@  discard block
 block discarded – undo
768 768
 	 * @return mixed data value at the specified field
769 769
 	 * @throws TInvalidDataValueException if the data is invalid
770 770
 	 */
771
-	protected function getDataFieldValue($data,$field)
771
+	protected function getDataFieldValue($data, $field)
772 772
 	{
773
-		return TDataFieldAccessor::getDataFieldValue($data,$field);
773
+		return TDataFieldAccessor::getDataFieldValue($data, $field);
774 774
 	}
775 775
 }
776 776
 
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	 * The repeater item control responsible for the event.
792 792
 	 * @var TControl
793 793
 	 */
794
-	private $_item=null;
794
+	private $_item = null;
795 795
 
796 796
 	/**
797 797
 	 * Constructor.
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 	 */
800 800
 	public function __construct($item)
801 801
 	{
802
-		$this->_item=$item;
802
+		$this->_item = $item;
803 803
 	}
804 804
 
805 805
 	/**
@@ -830,11 +830,11 @@  discard block
 block discarded – undo
830 830
 	/**
831 831
 	 * @var TControl the repeater item control responsible for the event.
832 832
 	 */
833
-	private $_item=null;
833
+	private $_item = null;
834 834
 	/**
835 835
 	 * @var TControl the control originally raises the <b>OnCommand</b> event.
836 836
 	 */
837
-	private $_source=null;
837
+	private $_source = null;
838 838
 
839 839
 	/**
840 840
 	 * Constructor.
@@ -842,11 +842,11 @@  discard block
 block discarded – undo
842 842
 	 * @param TControl original event sender
843 843
 	 * @param TCommandEventParameter original event parameter
844 844
 	 */
845
-	public function __construct($item,$source,TCommandEventParameter $param)
845
+	public function __construct($item, $source, TCommandEventParameter $param)
846 846
 	{
847
-		$this->_item=$item;
848
-		$this->_source=$source;
849
-		parent::__construct($param->getCommandName(),$param->getCommandParameter());
847
+		$this->_item = $item;
848
+		$this->_source = $source;
849
+		parent::__construct($param->getCommandName(), $param->getCommandParameter());
850 850
 	}
851 851
 
852 852
 	/**
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 	 */
910 910
 	public function setItemType($value)
911 911
 	{
912
-		$this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType');
912
+		$this->_itemType = TPropertyValue::ensureEnum($value, 'TListItemType');
913 913
 	}
914 914
 
915 915
 	/**
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 	 */
930 930
 	public function setItemIndex($value)
931 931
 	{
932
-		$this->_itemIndex=TPropertyValue::ensureInteger($value);
932
+		$this->_itemIndex = TPropertyValue::ensureInteger($value);
933 933
 	}
934 934
 
935 935
 	/**
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
 	 */
948 948
 	public function setData($value)
949 949
 	{
950
-		$this->_data=$value;
950
+		$this->_data = $value;
951 951
 	}
952 952
 
953 953
 	/**
@@ -977,11 +977,11 @@  discard block
 block discarded – undo
977 977
 	 * @param TEventParameter event parameter
978 978
 	 * @return boolean whether the event bubbling should stop here.
979 979
 	 */
980
-	public function bubbleEvent($sender,$param)
980
+	public function bubbleEvent($sender, $param)
981 981
 	{
982
-		if($param instanceof TCommandEventParameter)
982
+		if ($param instanceof TCommandEventParameter)
983 983
 		{
984
-			$this->raiseBubbleEvent($this,new TRepeaterCommandEventParameter($this,$sender,$param));
984
+			$this->raiseBubbleEvent($this, new TRepeaterCommandEventParameter($this, $sender, $param));
985 985
 			return true;
986 986
 		}
987 987
 		else
@@ -1008,10 +1008,10 @@  discard block
 block discarded – undo
1008 1008
 	 * @param TControl new item
1009 1009
 	 * @throws TInvalidDataTypeException if the item to be inserted is not a control.
1010 1010
 	 */
1011
-	public function insertAt($index,$item)
1011
+	public function insertAt($index, $item)
1012 1012
 	{
1013
-		if($item instanceof TControl)
1014
-			parent::insertAt($index,$item);
1013
+		if ($item instanceof TControl)
1014
+			parent::insertAt($index, $item);
1015 1015
 		else
1016 1016
 			throw new TInvalidDataTypeException('repeateritemcollection_item_invalid');
1017 1017
 	}
Please login to merge, or discard this patch.
Braces   +87 added lines, -71 removed lines patch added patch discarded remove patch
@@ -298,10 +298,11 @@  discard block
 block discarded – undo
298 298
 	 */
299 299
 	public function setItemTemplate($value)
300 300
 	{
301
-		if($value instanceof ITemplate || $value===null)
302
-			$this->_itemTemplate=$value;
303
-		else
304
-			throw new TInvalidDataTypeException('repeater_template_required','ItemTemplate');
301
+		if($value instanceof ITemplate || $value===null) {
302
+					$this->_itemTemplate=$value;
303
+		} else {
304
+					throw new TInvalidDataTypeException('repeater_template_required','ItemTemplate');
305
+		}
305 306
 	}
306 307
 
307 308
 	/**
@@ -318,10 +319,11 @@  discard block
 block discarded – undo
318 319
 	 */
319 320
 	public function setAlternatingItemTemplate($value)
320 321
 	{
321
-		if($value instanceof ITemplate || $value===null)
322
-			$this->_alternatingItemTemplate=$value;
323
-		else
324
-			throw new TInvalidDataTypeException('repeater_template_required','AlternatingItemTemplate');
322
+		if($value instanceof ITemplate || $value===null) {
323
+					$this->_alternatingItemTemplate=$value;
324
+		} else {
325
+					throw new TInvalidDataTypeException('repeater_template_required','AlternatingItemTemplate');
326
+		}
325 327
 	}
326 328
 
327 329
 	/**
@@ -338,10 +340,11 @@  discard block
 block discarded – undo
338 340
 	 */
339 341
 	public function setHeaderTemplate($value)
340 342
 	{
341
-		if($value instanceof ITemplate || $value===null)
342
-			$this->_headerTemplate=$value;
343
-		else
344
-			throw new TInvalidDataTypeException('repeater_template_required','HeaderTemplate');
343
+		if($value instanceof ITemplate || $value===null) {
344
+					$this->_headerTemplate=$value;
345
+		} else {
346
+					throw new TInvalidDataTypeException('repeater_template_required','HeaderTemplate');
347
+		}
345 348
 	}
346 349
 
347 350
 	/**
@@ -358,10 +361,11 @@  discard block
 block discarded – undo
358 361
 	 */
359 362
 	public function setFooterTemplate($value)
360 363
 	{
361
-		if($value instanceof ITemplate || $value===null)
362
-			$this->_footerTemplate=$value;
363
-		else
364
-			throw new TInvalidDataTypeException('repeater_template_required','FooterTemplate');
364
+		if($value instanceof ITemplate || $value===null) {
365
+					$this->_footerTemplate=$value;
366
+		} else {
367
+					throw new TInvalidDataTypeException('repeater_template_required','FooterTemplate');
368
+		}
365 369
 	}
366 370
 
367 371
 	/**
@@ -378,10 +382,11 @@  discard block
 block discarded – undo
378 382
 	 */
379 383
 	public function setEmptyTemplate($value)
380 384
 	{
381
-		if($value instanceof ITemplate || $value===null)
382
-			$this->_emptyTemplate=$value;
383
-		else
384
-			throw new TInvalidDataTypeException('repeater_template_required','EmptyTemplate');
385
+		if($value instanceof ITemplate || $value===null) {
386
+					$this->_emptyTemplate=$value;
387
+		} else {
388
+					throw new TInvalidDataTypeException('repeater_template_required','EmptyTemplate');
389
+		}
385 390
 	}
386 391
 
387 392
 	/**
@@ -398,10 +403,11 @@  discard block
 block discarded – undo
398 403
 	 */
399 404
 	public function setSeparatorTemplate($value)
400 405
 	{
401
-		if($value instanceof ITemplate || $value===null)
402
-			$this->_separatorTemplate=$value;
403
-		else
404
-			throw new TInvalidDataTypeException('repeater_template_required','SeparatorTemplate');
406
+		if($value instanceof ITemplate || $value===null) {
407
+					$this->_separatorTemplate=$value;
408
+		} else {
409
+					throw new TInvalidDataTypeException('repeater_template_required','SeparatorTemplate');
410
+		}
405 411
 	}
406 412
 
407 413
 	/**
@@ -425,8 +431,9 @@  discard block
 block discarded – undo
425 431
 	 */
426 432
 	public function getItems()
427 433
 	{
428
-		if(!$this->_items)
429
-			$this->_items=new TRepeaterItemCollection;
434
+		if(!$this->_items) {
435
+					$this->_items=new TRepeaterItemCollection;
436
+		}
430 437
 		return $this->_items;
431 438
 	}
432 439
 
@@ -474,9 +481,9 @@  discard block
 block discarded – undo
474 481
 			$this->onItemCreated($param);
475 482
 			$this->getControls()->add($item);
476 483
 			return $item;
484
+		} else {
485
+					return null;
477 486
 		}
478
-		else
479
-			return null;
480 487
 	}
481 488
 
482 489
 	/**
@@ -492,16 +499,17 @@  discard block
 block discarded – undo
492 499
 		if(($item=$this->createItem($itemIndex,$itemType))!==null)
493 500
 		{
494 501
 			$param=new TRepeaterItemEventParameter($item);
495
-			if($item instanceof IDataRenderer)
496
-				$item->setData($dataItem);
502
+			if($item instanceof IDataRenderer) {
503
+							$item->setData($dataItem);
504
+			}
497 505
 			$this->onItemCreated($param);
498 506
 			$this->getControls()->add($item);
499 507
 			$item->dataBind();
500 508
 			$this->onItemDataBound($param);
501 509
 			return $item;
510
+		} else {
511
+					return null;
502 512
 		}
503
-		else
504
-			return null;
505 513
 	}
506 514
 
507 515
 	/**
@@ -550,16 +558,15 @@  discard block
 block discarded – undo
550 558
 				$item->setItemIndex($itemIndex);
551 559
 				$item->setItemType($itemType);
552 560
 			}
553
-		}
554
-		else if($template!==null)
561
+		} else if($template!==null)
555 562
 		{
556 563
 			$item=new TRepeaterItem;
557 564
 			$item->setItemIndex($itemIndex);
558 565
 			$item->setItemType($itemType);
559 566
 			$template->instantiateIn($item);
567
+		} else {
568
+					$item=null;
560 569
 		}
561
-		else
562
-			$item=null;
563 570
 
564 571
 		return $item;
565 572
 	}
@@ -569,10 +576,11 @@  discard block
 block discarded – undo
569 576
 	 */
570 577
 	protected function createEmptyContent()
571 578
 	{
572
-		if(($classPath=$this->getEmptyRenderer())!=='')
573
-			$this->getControls()->add(Prado::createComponent($classPath));
574
-		else if($this->_emptyTemplate!==null)
575
-			$this->_emptyTemplate->instantiateIn($this);
579
+		if(($classPath=$this->getEmptyRenderer())!=='') {
580
+					$this->getControls()->add(Prado::createComponent($classPath));
581
+		} else if($this->_emptyTemplate!==null) {
582
+					$this->_emptyTemplate->instantiateIn($this);
583
+		}
576 584
 	}
577 585
 
578 586
 	/**
@@ -583,8 +591,9 @@  discard block
 block discarded – undo
583 591
 	 */
584 592
 	public function render($writer)
585 593
 	{
586
-		if($this->_items && $this->_items->getCount() || $this->_emptyTemplate!==null || $this->getEmptyRenderer()!=='')
587
-			$this->renderContents($writer);
594
+		if($this->_items && $this->_items->getCount() || $this->_emptyTemplate!==null || $this->getEmptyRenderer()!=='') {
595
+					$this->renderContents($writer);
596
+		}
588 597
 	}
589 598
 
590 599
 	/**
@@ -594,10 +603,11 @@  discard block
 block discarded – undo
594 603
 	public function saveState()
595 604
 	{
596 605
 		parent::saveState();
597
-		if($this->_items)
598
-			$this->setViewState('ItemCount',$this->_items->getCount(),0);
599
-		else
600
-			$this->clearViewState('ItemCount');
606
+		if($this->_items) {
607
+					$this->setViewState('ItemCount',$this->_items->getCount(),0);
608
+		} else {
609
+					$this->clearViewState('ItemCount');
610
+		}
601 611
 	}
602 612
 
603 613
 	/**
@@ -607,8 +617,9 @@  discard block
 block discarded – undo
607 617
 	public function loadState()
608 618
 	{
609 619
 		parent::loadState();
610
-		if(!$this->getIsDataBound())
611
-			$this->restoreItemsFromViewState();
620
+		if(!$this->getIsDataBound()) {
621
+					$this->restoreItemsFromViewState();
622
+		}
612 623
 		$this->clearViewState('ItemCount');
613 624
 	}
614 625
 
@@ -636,15 +647,16 @@  discard block
 block discarded – undo
636 647
 			$this->_header=$this->createItemInternal(-1,TListItemType::Header);
637 648
 			for($i=0;$i<$itemCount;++$i)
638 649
 			{
639
-				if($hasSeparator && $i>0)
640
-					$this->createItemInternal($i-1,TListItemType::Separator);
650
+				if($hasSeparator && $i>0) {
651
+									$this->createItemInternal($i-1,TListItemType::Separator);
652
+				}
641 653
 				$itemType=$i%2==0?TListItemType::Item : TListItemType::AlternatingItem;
642 654
 				$items->add($this->createItemInternal($i,$itemType,false,null));
643 655
 			}
644 656
 			$this->_footer=$this->createItemInternal(-1,TListItemType::Footer);
657
+		} else {
658
+					$this->createEmptyContent();
645 659
 		}
646
-		else
647
-			$this->createEmptyContent();
648 660
 		$this->clearChildState();
649 661
 	}
650 662
 
@@ -667,21 +679,24 @@  discard block
 block discarded – undo
667 679
 		$hasSeparator=$this->_separatorTemplate!==null || $this->getSeparatorRenderer()!=='';
668 680
 		foreach($data as $key=>$dataItem)
669 681
 		{
670
-			if($keyField!=='')
671
-				$keys->add($this->getDataFieldValue($dataItem,$keyField));
672
-			else
673
-				$keys->add($key);
674
-			if($itemIndex===0)
675
-				$this->_header=$this->createItemWithDataInternal(-1,TListItemType::Header,null);
676
-			if($hasSeparator && $itemIndex>0)
677
-				$this->createItemWithDataInternal($itemIndex-1,TListItemType::Separator,null);
682
+			if($keyField!=='') {
683
+							$keys->add($this->getDataFieldValue($dataItem,$keyField));
684
+			} else {
685
+							$keys->add($key);
686
+			}
687
+			if($itemIndex===0) {
688
+							$this->_header=$this->createItemWithDataInternal(-1,TListItemType::Header,null);
689
+			}
690
+			if($hasSeparator && $itemIndex>0) {
691
+							$this->createItemWithDataInternal($itemIndex-1,TListItemType::Separator,null);
692
+			}
678 693
 			$itemType=$itemIndex%2==0?TListItemType::Item : TListItemType::AlternatingItem;
679 694
 			$items->add($this->createItemWithDataInternal($itemIndex,$itemType,$dataItem));
680 695
 			$itemIndex++;
681 696
 		}
682
-		if($itemIndex>0)
683
-			$this->_footer=$this->createItemWithDataInternal(-1,TListItemType::Footer,null);
684
-		else
697
+		if($itemIndex>0) {
698
+					$this->_footer=$this->createItemWithDataInternal(-1,TListItemType::Footer,null);
699
+		} else
685 700
 		{
686 701
 			$this->createEmptyContent();
687 702
 			$this->dataBindChildren();
@@ -704,9 +719,9 @@  discard block
 block discarded – undo
704 719
 		{
705 720
 			$this->onItemCommand($param);
706 721
 			return true;
722
+		} else {
723
+					return false;
707 724
 		}
708
-		else
709
-			return false;
710 725
 	}
711 726
 
712 727
 	/**
@@ -983,9 +998,9 @@  discard block
 block discarded – undo
983 998
 		{
984 999
 			$this->raiseBubbleEvent($this,new TRepeaterCommandEventParameter($this,$sender,$param));
985 1000
 			return true;
1001
+		} else {
1002
+					return false;
986 1003
 		}
987
-		else
988
-			return false;
989 1004
 	}
990 1005
 }
991 1006
 
@@ -1010,10 +1025,11 @@  discard block
 block discarded – undo
1010 1025
 	 */
1011 1026
 	public function insertAt($index,$item)
1012 1027
 	{
1013
-		if($item instanceof TControl)
1014
-			parent::insertAt($index,$item);
1015
-		else
1016
-			throw new TInvalidDataTypeException('repeateritemcollection_item_invalid');
1028
+		if($item instanceof TControl) {
1029
+					parent::insertAt($index,$item);
1030
+		} else {
1031
+					throw new TInvalidDataTypeException('repeateritemcollection_item_invalid');
1032
+		}
1017 1033
 	}
1018 1034
 }
1019 1035
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TRepeatInfo.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -49,6 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param TRepeatInfo repeat information
50 50
 	 * @param string item type
51 51
 	 * @param integer zero-based index of the item being rendered
52
+	 * @return void
52 53
 	 */
53 54
 	public function renderItem($writer,$repeatInfo,$itemType,$index);
54 55
 }
@@ -218,6 +219,7 @@  discard block
 block discarded – undo
218 219
 	 * Renders contents in raw format.
219 220
 	 * @param THtmlWriter writer for the rendering purpose
220 221
 	 * @param IRepeatInfoUser repeat information user
222
+	 * @param IRepeatInfoUser $user
221 223
 	 */
222 224
 	protected function renderRawContents($writer,$user)
223 225
 	{
@@ -241,6 +243,7 @@  discard block
 block discarded – undo
241 243
 	 * Renders contents in horizontal repeat direction.
242 244
 	 * @param THtmlWriter writer for the rendering purpose
243 245
 	 * @param IRepeatInfoUser repeat information user
246
+	 * @param IRepeatInfoUser $user
244 247
 	 */
245 248
 	protected function renderHorizontalContents($writer,$user)
246 249
 	{
@@ -323,6 +326,7 @@  discard block
 block discarded – undo
323 326
 	 * Renders contents in veritcal repeat direction.
324 327
 	 * @param THtmlWriter writer for the rendering purpose
325 328
 	 * @param IRepeatInfoUser repeat information user
329
+	 * @param IRepeatInfoUser $user
326 330
 	 */
327 331
 	protected function renderVerticalContents($writer,$user)
328 332
 	{
@@ -456,6 +460,8 @@  discard block
 block discarded – undo
456 460
 	 * @param boolean whether to render using table layout
457 461
 	 * @param integer number of columns to be rendered
458 462
 	 * @param boolean if a line break is needed at the end
463
+	 * @param boolean $tableLayout
464
+	 * @param boolean $needBreak
459 465
 	 */
460 466
 	protected function renderHeader($writer,$user,$tableLayout,$columns,$needBreak)
461 467
 	{
@@ -489,6 +495,7 @@  discard block
 block discarded – undo
489 495
 	 * @param IRepeatInfoUser repeat information user
490 496
 	 * @param boolean whether to render using table layout
491 497
 	 * @param integer number of columns to be rendered
498
+	 * @param boolean $tableLayout
492 499
 	 */
493 500
 	protected function renderFooter($writer,$user,$tableLayout,$columns)
494 501
 	{
Please login to merge, or discard this patch.
Spacing   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 * @param integer zero-based index of the current rendering item.
43 43
 	 * @return TStyle CSS style used for rendering items (including header, footer and separators)
44 44
 	 */
45
-	public function generateItemStyle($itemType,$index);
45
+	public function generateItemStyle($itemType, $index);
46 46
 	/**
47 47
 	 * Renders an item.
48 48
 	 * @param THtmlWriter writer for the rendering purpose
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * @param string item type
51 51
 	 * @param integer zero-based index of the item being rendered
52 52
 	 */
53
-	public function renderItem($writer,$repeatInfo,$itemType,$index);
53
+	public function renderItem($writer, $repeatInfo, $itemType, $index);
54 54
 }
55 55
 
56 56
 /**
@@ -76,23 +76,23 @@  discard block
 block discarded – undo
76 76
 	/**
77 77
 	 * @var string caption of the table used to organize the repeated items
78 78
 	 */
79
-	private $_caption='';
79
+	private $_caption = '';
80 80
 	/**
81 81
 	 * @var TTableCaptionAlign alignment of the caption of the table used to organize the repeated items
82 82
 	 */
83
-	private $_captionAlign=TTableCaptionAlign::NotSet;
83
+	private $_captionAlign = TTableCaptionAlign::NotSet;
84 84
 	/**
85 85
 	 * @var integer number of columns that the items should be arranged in
86 86
 	 */
87
-	private $_repeatColumns=0;
87
+	private $_repeatColumns = 0;
88 88
 	/**
89 89
 	 * @var TRepeatDirection direction of the repetition
90 90
 	 */
91
-	private $_repeatDirection=TRepeatDirection::Vertical;
91
+	private $_repeatDirection = TRepeatDirection::Vertical;
92 92
 	/**
93 93
 	 * @var TRepeatLayout layout of the repeated items
94 94
 	 */
95
-	private $_repeatLayout=TRepeatLayout::Table;
95
+	private $_repeatLayout = TRepeatLayout::Table;
96 96
 
97 97
 	/**
98 98
 	 * @return string caption of the table layout
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function setCaption($value)
109 109
 	{
110
-		$this->_caption=$value;
110
+		$this->_caption = $value;
111 111
 	}
112 112
 
113 113
 	/**
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	public function setCaptionAlign($value)
125 125
 	{
126
-		$this->_captionAlign=TPropertyValue::ensureEnum($value,'TTableCaptionAlign');
126
+		$this->_captionAlign = TPropertyValue::ensureEnum($value, 'TTableCaptionAlign');
127 127
 	}
128 128
 
129 129
 	/**
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public function setRepeatColumns($value)
141 141
 	{
142
-		if(($value=TPropertyValue::ensureInteger($value))<0)
142
+		if (($value = TPropertyValue::ensureInteger($value)) < 0)
143 143
 			throw new TInvalidDataValueException('repeatinfo_repeatcolumns_invalid');
144
-		$this->_repeatColumns=$value;
144
+		$this->_repeatColumns = $value;
145 145
 	}
146 146
 
147 147
 	/**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function setRepeatDirection($value)
159 159
 	{
160
-		$this->_repeatDirection=TPropertyValue::ensureEnum($value,'TRepeatDirection');
160
+		$this->_repeatDirection = TPropertyValue::ensureEnum($value, 'TRepeatDirection');
161 161
 	}
162 162
 
163 163
 	/**
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	public function setRepeatLayout($value)
175 175
 	{
176
-		$this->_repeatLayout=TPropertyValue::ensureEnum($value,'TRepeatLayout');
176
+		$this->_repeatLayout = TPropertyValue::ensureEnum($value, 'TRepeatLayout');
177 177
 	}
178 178
 
179 179
 	/**
@@ -183,33 +183,33 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public function renderRepeater($writer, IRepeatInfoUser $user)
185 185
 	{
186
-		if($this->_repeatLayout===TRepeatLayout::Table)
186
+		if ($this->_repeatLayout === TRepeatLayout::Table)
187 187
 		{
188
-			$control=new TTable;
189
-			if($this->_caption!=='')
188
+			$control = new TTable;
189
+			if ($this->_caption !== '')
190 190
 			{
191 191
 				$control->setCaption($this->_caption);
192 192
 				$control->setCaptionAlign($this->_captionAlign);
193 193
 			}
194 194
 		}
195
-		else if($this->_repeatLayout===TRepeatLayout::Raw)
195
+		else if ($this->_repeatLayout === TRepeatLayout::Raw)
196 196
 		{
197
-			$this->renderRawContents($writer,$user);
197
+			$this->renderRawContents($writer, $user);
198 198
 			return;
199 199
 		}
200 200
 		else
201
-			$control=new TWebControl;
201
+			$control = new TWebControl;
202 202
 		$control->setID($user->getClientID());
203 203
 		$control->copyBaseAttributes($user);
204
-		if($user->getHasStyle())
204
+		if ($user->getHasStyle())
205 205
 			$control->getStyle()->copyFrom($user->getStyle());
206 206
 		$control->renderBeginTag($writer);
207 207
 		$writer->writeLine();
208 208
 
209
-		if($this->_repeatDirection===TRepeatDirection::Vertical)
210
-			$this->renderVerticalContents($writer,$user);
209
+		if ($this->_repeatDirection === TRepeatDirection::Vertical)
210
+			$this->renderVerticalContents($writer, $user);
211 211
 		else
212
-			$this->renderHorizontalContents($writer,$user);
212
+			$this->renderHorizontalContents($writer, $user);
213 213
 
214 214
 		$control->renderEndTag($writer);
215 215
 	}
@@ -219,22 +219,22 @@  discard block
 block discarded – undo
219 219
 	 * @param THtmlWriter writer for the rendering purpose
220 220
 	 * @param IRepeatInfoUser repeat information user
221 221
 	 */
222
-	protected function renderRawContents($writer,$user)
222
+	protected function renderRawContents($writer, $user)
223 223
 	{
224
-		if($user->getHasHeader())
225
-			$user->renderItem($writer,$this,'Header',-1);
224
+		if ($user->getHasHeader())
225
+			$user->renderItem($writer, $this, 'Header', -1);
226 226
 
227 227
 		// render items
228
-		$hasSeparators=$user->getHasSeparators();
229
-		$itemCount=$user->getItemCount();
230
-		for($i=0;$i<$itemCount;++$i)
228
+		$hasSeparators = $user->getHasSeparators();
229
+		$itemCount = $user->getItemCount();
230
+		for ($i = 0; $i < $itemCount; ++$i)
231 231
 		{
232
-			$user->renderItem($writer,$this,'Item',$i);
233
-			if($hasSeparators && $i!=$itemCount-1)
234
-				$user->renderItem($writer,$this,'Separator',$i);
232
+			$user->renderItem($writer, $this, 'Item', $i);
233
+			if ($hasSeparators && $i != $itemCount - 1)
234
+				$user->renderItem($writer, $this, 'Separator', $i);
235 235
 		}
236
-		if($user->getHasFooter())
237
-			$user->renderItem($writer,$this,'Footer',-1);
236
+		if ($user->getHasFooter())
237
+			$user->renderItem($writer, $this, 'Footer', -1);
238 238
 	}
239 239
 
240 240
 	/**
@@ -242,81 +242,81 @@  discard block
 block discarded – undo
242 242
 	 * @param THtmlWriter writer for the rendering purpose
243 243
 	 * @param IRepeatInfoUser repeat information user
244 244
 	 */
245
-	protected function renderHorizontalContents($writer,$user)
245
+	protected function renderHorizontalContents($writer, $user)
246 246
 	{
247
-		$tableLayout=($this->_repeatLayout===TRepeatLayout::Table);
248
-		$hasSeparators=$user->getHasSeparators();
249
-		$itemCount=$user->getItemCount();
250
-		$columns=$this->_repeatColumns===0?$itemCount:$this->_repeatColumns;
251
-		$totalColumns=$hasSeparators?$columns+$columns:$columns;
252
-		$needBreak=$columns<$itemCount;
247
+		$tableLayout = ($this->_repeatLayout === TRepeatLayout::Table);
248
+		$hasSeparators = $user->getHasSeparators();
249
+		$itemCount = $user->getItemCount();
250
+		$columns = $this->_repeatColumns === 0 ? $itemCount : $this->_repeatColumns;
251
+		$totalColumns = $hasSeparators ? $columns + $columns : $columns;
252
+		$needBreak = $columns < $itemCount;
253 253
 
254
-		if($user->getHasHeader())
255
-			$this->renderHeader($writer,$user,$tableLayout,$totalColumns,$needBreak);
254
+		if ($user->getHasHeader())
255
+			$this->renderHeader($writer, $user, $tableLayout, $totalColumns, $needBreak);
256 256
 
257 257
 		// render items
258
-		if($tableLayout)
258
+		if ($tableLayout)
259 259
 		{
260 260
 			$writer->renderBeginTag('tbody');
261
-			$column=0;
262
-			for($i=0;$i<$itemCount;++$i)
261
+			$column = 0;
262
+			for ($i = 0; $i < $itemCount; ++$i)
263 263
 			{
264
-				if($column==0)
264
+				if ($column == 0)
265 265
 					$writer->renderBeginTag('tr');
266
-				if(($style=$user->generateItemStyle('Item',$i))!==null)
266
+				if (($style = $user->generateItemStyle('Item', $i)) !== null)
267 267
 					$style->addAttributesToRender($writer);
268 268
 				$writer->renderBeginTag('td');
269
-				$user->renderItem($writer,$this,'Item',$i);
269
+				$user->renderItem($writer, $this, 'Item', $i);
270 270
 				$writer->renderEndTag();
271 271
 				$writer->writeLine();
272
-				if($hasSeparators && $i!=$itemCount-1)
272
+				if ($hasSeparators && $i != $itemCount - 1)
273 273
 				{
274
-					if(($style=$user->generateItemStyle('Separator',$i))!==null)
274
+					if (($style = $user->generateItemStyle('Separator', $i)) !== null)
275 275
 						$style->addAttributesToRender($writer);
276 276
 					$writer->renderBeginTag('td');
277
-					$user->renderItem($writer,$this,'Separator',$i);
277
+					$user->renderItem($writer, $this, 'Separator', $i);
278 278
 					$writer->renderEndTag();
279 279
 					$writer->writeLine();
280 280
 				}
281 281
 				$column++;
282
-				if($i==$itemCount-1)
282
+				if ($i == $itemCount - 1)
283 283
 				{
284
-					$restColumns=$columns-$column;
285
-					if($hasSeparators)
286
-						$restColumns=$restColumns?$restColumns+$restColumns+1:1;
287
-					for($j=0;$j<$restColumns;++$j)
284
+					$restColumns = $columns - $column;
285
+					if ($hasSeparators)
286
+						$restColumns = $restColumns ? $restColumns + $restColumns + 1 : 1;
287
+					for ($j = 0; $j < $restColumns; ++$j)
288 288
 						$writer->write("<td></td>\n");
289 289
 				}
290
-				if($column==$columns || $i==$itemCount-1)
290
+				if ($column == $columns || $i == $itemCount - 1)
291 291
 				{
292 292
 					$writer->renderEndTag();
293 293
 					$writer->writeLine();
294
-					$column=0;
294
+					$column = 0;
295 295
 				}
296 296
 			}
297 297
 			$writer->renderEndTag();
298 298
 		}
299 299
 		else
300 300
 		{
301
-			$column=0;
302
-			for($i=0;$i<$itemCount;++$i)
301
+			$column = 0;
302
+			for ($i = 0; $i < $itemCount; ++$i)
303 303
 			{
304
-				$user->renderItem($writer,$this,'Item',$i);
305
-				if($hasSeparators && $i!=$itemCount-1)
306
-					$user->renderItem($writer,$this,'Separator',$i);
304
+				$user->renderItem($writer, $this, 'Item', $i);
305
+				if ($hasSeparators && $i != $itemCount - 1)
306
+					$user->renderItem($writer, $this, 'Separator', $i);
307 307
 				$column++;
308
-				if($column==$columns || $i==$itemCount-1)
308
+				if ($column == $columns || $i == $itemCount - 1)
309 309
 				{
310
-					if($needBreak)
310
+					if ($needBreak)
311 311
 						$writer->writeBreak();
312
-					$column=0;
312
+					$column = 0;
313 313
 				}
314 314
 				$writer->writeLine();
315 315
 			}
316 316
 		}
317 317
 
318
-		if($user->getHasFooter())
319
-			$this->renderFooter($writer,$user,$tableLayout,$totalColumns,$needBreak);
318
+		if ($user->getHasFooter())
319
+			$this->renderFooter($writer, $user, $tableLayout, $totalColumns, $needBreak);
320 320
 	}
321 321
 
322 322
 	/**
@@ -324,83 +324,83 @@  discard block
 block discarded – undo
324 324
 	 * @param THtmlWriter writer for the rendering purpose
325 325
 	 * @param IRepeatInfoUser repeat information user
326 326
 	 */
327
-	protected function renderVerticalContents($writer,$user)
327
+	protected function renderVerticalContents($writer, $user)
328 328
 	{
329
-		$tableLayout=($this->_repeatLayout===TRepeatLayout::Table);
330
-		$hasSeparators=$user->getHasSeparators();
331
-		$itemCount=$user->getItemCount();
332
-		if($this->_repeatColumns<=1)
329
+		$tableLayout = ($this->_repeatLayout === TRepeatLayout::Table);
330
+		$hasSeparators = $user->getHasSeparators();
331
+		$itemCount = $user->getItemCount();
332
+		if ($this->_repeatColumns <= 1)
333 333
 		{
334
-			$rows=$itemCount;
335
-			$columns=1;
336
-			$lastColumns=1;
334
+			$rows = $itemCount;
335
+			$columns = 1;
336
+			$lastColumns = 1;
337 337
 		}
338 338
 		else
339 339
 		{
340
-			$columns=$this->_repeatColumns;
341
-			$rows=(int)(($itemCount+$columns-1)/$columns);
342
-			if($rows==0 && $itemCount>0)
343
-				$rows=1;
344
-			if(($lastColumns=$itemCount%$columns)==0)
345
-				$lastColumns=$columns;
340
+			$columns = $this->_repeatColumns;
341
+			$rows = (int) (($itemCount + $columns - 1) / $columns);
342
+			if ($rows == 0 && $itemCount > 0)
343
+				$rows = 1;
344
+			if (($lastColumns = $itemCount % $columns) == 0)
345
+				$lastColumns = $columns;
346 346
 		}
347
-		$totalColumns=$hasSeparators?$columns+$columns:$columns;
347
+		$totalColumns = $hasSeparators ? $columns + $columns : $columns;
348 348
 
349
-		if($user->getHasHeader())
350
-			$this->renderHeader($writer,$user,$tableLayout,$totalColumns,false);
349
+		if ($user->getHasHeader())
350
+			$this->renderHeader($writer, $user, $tableLayout, $totalColumns, false);
351 351
 
352
-		if($tableLayout)
352
+		if ($tableLayout)
353 353
 		{
354 354
 			$writer->renderBeginTag('tbody');
355
-			$renderedItems=0;
356
-			for($row=0;$row<$rows;++$row)
355
+			$renderedItems = 0;
356
+			for ($row = 0; $row < $rows; ++$row)
357 357
 			{
358
-				$index=$row;
358
+				$index = $row;
359 359
 				$writer->renderBeginTag('tr');
360
-				for($col=0;$col<$columns;++$col)
360
+				for ($col = 0; $col < $columns; ++$col)
361 361
 				{
362
-					if($renderedItems>=$itemCount)
362
+					if ($renderedItems >= $itemCount)
363 363
 						break;
364
-					if($col>0)
364
+					if ($col > 0)
365 365
 					{
366
-						$index+=$rows;
367
-						if($col-1>=$lastColumns)
366
+						$index += $rows;
367
+						if ($col - 1 >= $lastColumns)
368 368
 							$index--;
369 369
 					}
370
-					if($index>=$itemCount)
370
+					if ($index >= $itemCount)
371 371
 						continue;
372 372
 					$renderedItems++;
373
-					if(($style=$user->generateItemStyle('Item',$index))!==null)
373
+					if (($style = $user->generateItemStyle('Item', $index)) !== null)
374 374
 						$style->addAttributesToRender($writer);
375 375
 					$writer->renderBeginTag('td');
376
-					$user->renderItem($writer,$this,'Item',$index);
376
+					$user->renderItem($writer, $this, 'Item', $index);
377 377
 					$writer->renderEndTag();
378 378
 					$writer->writeLine();
379
-					if(!$hasSeparators)
379
+					if (!$hasSeparators)
380 380
 						continue;
381
-					if($renderedItems<$itemCount-1)
381
+					if ($renderedItems < $itemCount - 1)
382 382
 					{
383
-						if($columns==1)
383
+						if ($columns == 1)
384 384
 						{
385 385
 							$writer->renderEndTag();
386 386
 							$writer->renderBeginTag('tr');
387 387
 						}
388
-						if(($style=$user->generateItemStyle('Separator',$index))!==null)
388
+						if (($style = $user->generateItemStyle('Separator', $index)) !== null)
389 389
 							$style->addAttributesToRender($writer);
390 390
 						$writer->renderBeginTag('td');
391
-						$user->renderItem($writer,$this,'Separator',$index);
391
+						$user->renderItem($writer, $this, 'Separator', $index);
392 392
 						$writer->renderEndTag();
393 393
 						$writer->writeLine();
394 394
 					}
395
-					else if($columns>1)
395
+					else if ($columns > 1)
396 396
 						$writer->write("<td></td>\n");
397 397
 				}
398
-				if($row==$rows-1)
398
+				if ($row == $rows - 1)
399 399
 				{
400
-					$restColumns=$columns-$lastColumns;
401
-					if($hasSeparators)
402
-						$restColumns+=$restColumns;
403
-					for($col=0;$col<$restColumns;++$col)
400
+					$restColumns = $columns - $lastColumns;
401
+					if ($hasSeparators)
402
+						$restColumns += $restColumns;
403
+					for ($col = 0; $col < $restColumns; ++$col)
404 404
 						$writer->write("<td></td>\n");
405 405
 				}
406 406
 				$writer->renderEndTag();
@@ -410,42 +410,42 @@  discard block
 block discarded – undo
410 410
 		}
411 411
 		else
412 412
 		{
413
-			$renderedItems=0;
414
-			for($row=0;$row<$rows;++$row)
413
+			$renderedItems = 0;
414
+			for ($row = 0; $row < $rows; ++$row)
415 415
 			{
416
-				$index=$row;
417
-				for($col=0;$col<$columns;++$col)
416
+				$index = $row;
417
+				for ($col = 0; $col < $columns; ++$col)
418 418
 				{
419
-					if($renderedItems>=$itemCount)
419
+					if ($renderedItems >= $itemCount)
420 420
 						break;
421
-					if($col>0)
421
+					if ($col > 0)
422 422
 					{
423
-						$index+=$rows;
424
-						if($col-1>=$lastColumns)
423
+						$index += $rows;
424
+						if ($col - 1 >= $lastColumns)
425 425
 							$index--;
426 426
 					}
427
-					if($index>=$itemCount)
427
+					if ($index >= $itemCount)
428 428
 						continue;
429 429
 					$renderedItems++;
430
-					$user->renderItem($writer,$this,'Item',$index);
430
+					$user->renderItem($writer, $this, 'Item', $index);
431 431
 					$writer->writeLine();
432
-					if(!$hasSeparators)
432
+					if (!$hasSeparators)
433 433
 						continue;
434
-					if($renderedItems<$itemCount-1)
434
+					if ($renderedItems < $itemCount - 1)
435 435
 					{
436
-						if($columns==1)
436
+						if ($columns == 1)
437 437
 							$writer->writeBreak();
438
-						$user->renderItem($writer,$this,'Separator',$index);
438
+						$user->renderItem($writer, $this, 'Separator', $index);
439 439
 					}
440 440
 					$writer->writeLine();
441 441
 				}
442
-				if($row<$rows-1 || $user->getHasFooter())
442
+				if ($row < $rows - 1 || $user->getHasFooter())
443 443
 					$writer->writeBreak();
444 444
 			}
445 445
 		}
446 446
 
447
-		if($user->getHasFooter())
448
-			$this->renderFooter($writer,$user,$tableLayout,$totalColumns,false);
447
+		if ($user->getHasFooter())
448
+			$this->renderFooter($writer, $user, $tableLayout, $totalColumns, false);
449 449
 
450 450
 	}
451 451
 
@@ -457,27 +457,27 @@  discard block
 block discarded – undo
457 457
 	 * @param integer number of columns to be rendered
458 458
 	 * @param boolean if a line break is needed at the end
459 459
 	 */
460
-	protected function renderHeader($writer,$user,$tableLayout,$columns,$needBreak)
460
+	protected function renderHeader($writer, $user, $tableLayout, $columns, $needBreak)
461 461
 	{
462
-		if($tableLayout)
462
+		if ($tableLayout)
463 463
 		{
464 464
 			$writer->renderBeginTag('thead');
465 465
 			$writer->renderBeginTag('tr');
466
-			if($columns>1)
467
-				$writer->addAttribute('colspan',"$columns");
468
-			$writer->addAttribute('scope','col');
469
-			if(($style=$user->generateItemStyle('Header',-1))!==null)
466
+			if ($columns > 1)
467
+				$writer->addAttribute('colspan', "$columns");
468
+			$writer->addAttribute('scope', 'col');
469
+			if (($style = $user->generateItemStyle('Header', -1)) !== null)
470 470
 				$style->addAttributesToRender($writer);
471 471
 			$writer->renderBeginTag('th');
472
-			$user->renderItem($writer,$this,'Header',-1);
472
+			$user->renderItem($writer, $this, 'Header', -1);
473 473
 			$writer->renderEndTag();
474 474
 			$writer->renderEndTag();
475 475
 			$writer->renderEndTag();
476 476
 		}
477 477
 		else
478 478
 		{
479
-			$user->renderItem($writer,$this,'Header',-1);
480
-			if($needBreak)
479
+			$user->renderItem($writer, $this, 'Header', -1);
480
+			if ($needBreak)
481 481
 				$writer->writeBreak();
482 482
 		}
483 483
 		$writer->writeLine();
@@ -490,24 +490,24 @@  discard block
 block discarded – undo
490 490
 	 * @param boolean whether to render using table layout
491 491
 	 * @param integer number of columns to be rendered
492 492
 	 */
493
-	protected function renderFooter($writer,$user,$tableLayout,$columns)
493
+	protected function renderFooter($writer, $user, $tableLayout, $columns)
494 494
 	{
495
-		if($tableLayout)
495
+		if ($tableLayout)
496 496
 		{
497 497
 			$writer->renderBeginTag('tfoot');
498 498
 			$writer->renderBeginTag('tr');
499
-			if($columns>1)
500
-				$writer->addAttribute('colspan',"$columns");
501
-			if(($style=$user->generateItemStyle('Footer',-1))!==null)
499
+			if ($columns > 1)
500
+				$writer->addAttribute('colspan', "$columns");
501
+			if (($style = $user->generateItemStyle('Footer', -1)) !== null)
502 502
 				$style->addAttributesToRender($writer);
503 503
 			$writer->renderBeginTag('td');
504
-			$user->renderItem($writer,$this,'Footer',-1);
504
+			$user->renderItem($writer, $this, 'Footer', -1);
505 505
 			$writer->renderEndTag();
506 506
 			$writer->renderEndTag();
507 507
 			$writer->renderEndTag();
508 508
 		}
509 509
 		else
510
-			$user->renderItem($writer,$this,'Footer',-1);
510
+			$user->renderItem($writer, $this, 'Footer', -1);
511 511
 		$writer->writeLine();
512 512
 	}
513 513
 }
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
  */
529 529
 class TRepeatDirection extends TEnumerable
530 530
 {
531
-	const Vertical='Vertical';
532
-	const Horizontal='Horizontal';
531
+	const Vertical = 'Vertical';
532
+	const Horizontal = 'Horizontal';
533 533
 }
534 534
 
535 535
 /**
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
  */
549 549
 class TRepeatLayout extends TEnumerable
550 550
 {
551
-	const Table='Table';
552
-	const Flow='Flow';
553
-	const Raw='Raw';
551
+	const Table = 'Table';
552
+	const Flow = 'Flow';
553
+	const Raw = 'Raw';
554 554
 }
555 555
 
Please login to merge, or discard this patch.
Braces   +127 added lines, -94 removed lines patch added patch discarded remove patch
@@ -139,8 +139,9 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public function setRepeatColumns($value)
141 141
 	{
142
-		if(($value=TPropertyValue::ensureInteger($value))<0)
143
-			throw new TInvalidDataValueException('repeatinfo_repeatcolumns_invalid');
142
+		if(($value=TPropertyValue::ensureInteger($value))<0) {
143
+					throw new TInvalidDataValueException('repeatinfo_repeatcolumns_invalid');
144
+		}
144 145
 		$this->_repeatColumns=$value;
145 146
 	}
146 147
 
@@ -191,25 +192,26 @@  discard block
 block discarded – undo
191 192
 				$control->setCaption($this->_caption);
192 193
 				$control->setCaptionAlign($this->_captionAlign);
193 194
 			}
194
-		}
195
-		else if($this->_repeatLayout===TRepeatLayout::Raw)
195
+		} else if($this->_repeatLayout===TRepeatLayout::Raw)
196 196
 		{
197 197
 			$this->renderRawContents($writer,$user);
198 198
 			return;
199
+		} else {
200
+					$control=new TWebControl;
199 201
 		}
200
-		else
201
-			$control=new TWebControl;
202 202
 		$control->setID($user->getClientID());
203 203
 		$control->copyBaseAttributes($user);
204
-		if($user->getHasStyle())
205
-			$control->getStyle()->copyFrom($user->getStyle());
204
+		if($user->getHasStyle()) {
205
+					$control->getStyle()->copyFrom($user->getStyle());
206
+		}
206 207
 		$control->renderBeginTag($writer);
207 208
 		$writer->writeLine();
208 209
 
209
-		if($this->_repeatDirection===TRepeatDirection::Vertical)
210
-			$this->renderVerticalContents($writer,$user);
211
-		else
212
-			$this->renderHorizontalContents($writer,$user);
210
+		if($this->_repeatDirection===TRepeatDirection::Vertical) {
211
+					$this->renderVerticalContents($writer,$user);
212
+		} else {
213
+					$this->renderHorizontalContents($writer,$user);
214
+		}
213 215
 
214 216
 		$control->renderEndTag($writer);
215 217
 	}
@@ -221,8 +223,9 @@  discard block
 block discarded – undo
221 223
 	 */
222 224
 	protected function renderRawContents($writer,$user)
223 225
 	{
224
-		if($user->getHasHeader())
225
-			$user->renderItem($writer,$this,'Header',-1);
226
+		if($user->getHasHeader()) {
227
+					$user->renderItem($writer,$this,'Header',-1);
228
+		}
226 229
 
227 230
 		// render items
228 231
 		$hasSeparators=$user->getHasSeparators();
@@ -230,11 +233,13 @@  discard block
 block discarded – undo
230 233
 		for($i=0;$i<$itemCount;++$i)
231 234
 		{
232 235
 			$user->renderItem($writer,$this,'Item',$i);
233
-			if($hasSeparators && $i!=$itemCount-1)
234
-				$user->renderItem($writer,$this,'Separator',$i);
236
+			if($hasSeparators && $i!=$itemCount-1) {
237
+							$user->renderItem($writer,$this,'Separator',$i);
238
+			}
239
+		}
240
+		if($user->getHasFooter()) {
241
+					$user->renderItem($writer,$this,'Footer',-1);
235 242
 		}
236
-		if($user->getHasFooter())
237
-			$user->renderItem($writer,$this,'Footer',-1);
238 243
 	}
239 244
 
240 245
 	/**
@@ -251,8 +256,9 @@  discard block
 block discarded – undo
251 256
 		$totalColumns=$hasSeparators?$columns+$columns:$columns;
252 257
 		$needBreak=$columns<$itemCount;
253 258
 
254
-		if($user->getHasHeader())
255
-			$this->renderHeader($writer,$user,$tableLayout,$totalColumns,$needBreak);
259
+		if($user->getHasHeader()) {
260
+					$this->renderHeader($writer,$user,$tableLayout,$totalColumns,$needBreak);
261
+		}
256 262
 
257 263
 		// render items
258 264
 		if($tableLayout)
@@ -261,18 +267,21 @@  discard block
 block discarded – undo
261 267
 			$column=0;
262 268
 			for($i=0;$i<$itemCount;++$i)
263 269
 			{
264
-				if($column==0)
265
-					$writer->renderBeginTag('tr');
266
-				if(($style=$user->generateItemStyle('Item',$i))!==null)
267
-					$style->addAttributesToRender($writer);
270
+				if($column==0) {
271
+									$writer->renderBeginTag('tr');
272
+				}
273
+				if(($style=$user->generateItemStyle('Item',$i))!==null) {
274
+									$style->addAttributesToRender($writer);
275
+				}
268 276
 				$writer->renderBeginTag('td');
269 277
 				$user->renderItem($writer,$this,'Item',$i);
270 278
 				$writer->renderEndTag();
271 279
 				$writer->writeLine();
272 280
 				if($hasSeparators && $i!=$itemCount-1)
273 281
 				{
274
-					if(($style=$user->generateItemStyle('Separator',$i))!==null)
275
-						$style->addAttributesToRender($writer);
282
+					if(($style=$user->generateItemStyle('Separator',$i))!==null) {
283
+											$style->addAttributesToRender($writer);
284
+					}
276 285
 					$writer->renderBeginTag('td');
277 286
 					$user->renderItem($writer,$this,'Separator',$i);
278 287
 					$writer->renderEndTag();
@@ -282,10 +291,12 @@  discard block
 block discarded – undo
282 291
 				if($i==$itemCount-1)
283 292
 				{
284 293
 					$restColumns=$columns-$column;
285
-					if($hasSeparators)
286
-						$restColumns=$restColumns?$restColumns+$restColumns+1:1;
287
-					for($j=0;$j<$restColumns;++$j)
288
-						$writer->write("<td></td>\n");
294
+					if($hasSeparators) {
295
+											$restColumns=$restColumns?$restColumns+$restColumns+1:1;
296
+					}
297
+					for($j=0;$j<$restColumns;++$j) {
298
+											$writer->write("<td></td>\n");
299
+					}
289 300
 				}
290 301
 				if($column==$columns || $i==$itemCount-1)
291 302
 				{
@@ -295,28 +306,30 @@  discard block
 block discarded – undo
295 306
 				}
296 307
 			}
297 308
 			$writer->renderEndTag();
298
-		}
299
-		else
309
+		} else
300 310
 		{
301 311
 			$column=0;
302 312
 			for($i=0;$i<$itemCount;++$i)
303 313
 			{
304 314
 				$user->renderItem($writer,$this,'Item',$i);
305
-				if($hasSeparators && $i!=$itemCount-1)
306
-					$user->renderItem($writer,$this,'Separator',$i);
315
+				if($hasSeparators && $i!=$itemCount-1) {
316
+									$user->renderItem($writer,$this,'Separator',$i);
317
+				}
307 318
 				$column++;
308 319
 				if($column==$columns || $i==$itemCount-1)
309 320
 				{
310
-					if($needBreak)
311
-						$writer->writeBreak();
321
+					if($needBreak) {
322
+											$writer->writeBreak();
323
+					}
312 324
 					$column=0;
313 325
 				}
314 326
 				$writer->writeLine();
315 327
 			}
316 328
 		}
317 329
 
318
-		if($user->getHasFooter())
319
-			$this->renderFooter($writer,$user,$tableLayout,$totalColumns,$needBreak);
330
+		if($user->getHasFooter()) {
331
+					$this->renderFooter($writer,$user,$tableLayout,$totalColumns,$needBreak);
332
+		}
320 333
 	}
321 334
 
322 335
 	/**
@@ -334,20 +347,22 @@  discard block
 block discarded – undo
334 347
 			$rows=$itemCount;
335 348
 			$columns=1;
336 349
 			$lastColumns=1;
337
-		}
338
-		else
350
+		} else
339 351
 		{
340 352
 			$columns=$this->_repeatColumns;
341 353
 			$rows=(int)(($itemCount+$columns-1)/$columns);
342
-			if($rows==0 && $itemCount>0)
343
-				$rows=1;
344
-			if(($lastColumns=$itemCount%$columns)==0)
345
-				$lastColumns=$columns;
354
+			if($rows==0 && $itemCount>0) {
355
+							$rows=1;
356
+			}
357
+			if(($lastColumns=$itemCount%$columns)==0) {
358
+							$lastColumns=$columns;
359
+			}
346 360
 		}
347 361
 		$totalColumns=$hasSeparators?$columns+$columns:$columns;
348 362
 
349
-		if($user->getHasHeader())
350
-			$this->renderHeader($writer,$user,$tableLayout,$totalColumns,false);
363
+		if($user->getHasHeader()) {
364
+					$this->renderHeader($writer,$user,$tableLayout,$totalColumns,false);
365
+		}
351 366
 
352 367
 		if($tableLayout)
353 368
 		{
@@ -359,25 +374,30 @@  discard block
 block discarded – undo
359 374
 				$writer->renderBeginTag('tr');
360 375
 				for($col=0;$col<$columns;++$col)
361 376
 				{
362
-					if($renderedItems>=$itemCount)
363
-						break;
377
+					if($renderedItems>=$itemCount) {
378
+											break;
379
+					}
364 380
 					if($col>0)
365 381
 					{
366 382
 						$index+=$rows;
367
-						if($col-1>=$lastColumns)
368
-							$index--;
383
+						if($col-1>=$lastColumns) {
384
+													$index--;
385
+						}
386
+					}
387
+					if($index>=$itemCount) {
388
+											continue;
369 389
 					}
370
-					if($index>=$itemCount)
371
-						continue;
372 390
 					$renderedItems++;
373
-					if(($style=$user->generateItemStyle('Item',$index))!==null)
374
-						$style->addAttributesToRender($writer);
391
+					if(($style=$user->generateItemStyle('Item',$index))!==null) {
392
+											$style->addAttributesToRender($writer);
393
+					}
375 394
 					$writer->renderBeginTag('td');
376 395
 					$user->renderItem($writer,$this,'Item',$index);
377 396
 					$writer->renderEndTag();
378 397
 					$writer->writeLine();
379
-					if(!$hasSeparators)
380
-						continue;
398
+					if(!$hasSeparators) {
399
+											continue;
400
+					}
381 401
 					if($renderedItems<$itemCount-1)
382 402
 					{
383 403
 						if($columns==1)
@@ -385,30 +405,32 @@  discard block
 block discarded – undo
385 405
 							$writer->renderEndTag();
386 406
 							$writer->renderBeginTag('tr');
387 407
 						}
388
-						if(($style=$user->generateItemStyle('Separator',$index))!==null)
389
-							$style->addAttributesToRender($writer);
408
+						if(($style=$user->generateItemStyle('Separator',$index))!==null) {
409
+													$style->addAttributesToRender($writer);
410
+						}
390 411
 						$writer->renderBeginTag('td');
391 412
 						$user->renderItem($writer,$this,'Separator',$index);
392 413
 						$writer->renderEndTag();
393 414
 						$writer->writeLine();
415
+					} else if($columns>1) {
416
+											$writer->write("<td></td>\n");
394 417
 					}
395
-					else if($columns>1)
396
-						$writer->write("<td></td>\n");
397 418
 				}
398 419
 				if($row==$rows-1)
399 420
 				{
400 421
 					$restColumns=$columns-$lastColumns;
401
-					if($hasSeparators)
402
-						$restColumns+=$restColumns;
403
-					for($col=0;$col<$restColumns;++$col)
404
-						$writer->write("<td></td>\n");
422
+					if($hasSeparators) {
423
+											$restColumns+=$restColumns;
424
+					}
425
+					for($col=0;$col<$restColumns;++$col) {
426
+											$writer->write("<td></td>\n");
427
+					}
405 428
 				}
406 429
 				$writer->renderEndTag();
407 430
 				$writer->writeLine();
408 431
 			}
409 432
 			$writer->renderEndTag();
410
-		}
411
-		else
433
+		} else
412 434
 		{
413 435
 			$renderedItems=0;
414 436
 			for($row=0;$row<$rows;++$row)
@@ -416,36 +438,43 @@  discard block
 block discarded – undo
416 438
 				$index=$row;
417 439
 				for($col=0;$col<$columns;++$col)
418 440
 				{
419
-					if($renderedItems>=$itemCount)
420
-						break;
441
+					if($renderedItems>=$itemCount) {
442
+											break;
443
+					}
421 444
 					if($col>0)
422 445
 					{
423 446
 						$index+=$rows;
424
-						if($col-1>=$lastColumns)
425
-							$index--;
447
+						if($col-1>=$lastColumns) {
448
+													$index--;
449
+						}
450
+					}
451
+					if($index>=$itemCount) {
452
+											continue;
426 453
 					}
427
-					if($index>=$itemCount)
428
-						continue;
429 454
 					$renderedItems++;
430 455
 					$user->renderItem($writer,$this,'Item',$index);
431 456
 					$writer->writeLine();
432
-					if(!$hasSeparators)
433
-						continue;
457
+					if(!$hasSeparators) {
458
+											continue;
459
+					}
434 460
 					if($renderedItems<$itemCount-1)
435 461
 					{
436
-						if($columns==1)
437
-							$writer->writeBreak();
462
+						if($columns==1) {
463
+													$writer->writeBreak();
464
+						}
438 465
 						$user->renderItem($writer,$this,'Separator',$index);
439 466
 					}
440 467
 					$writer->writeLine();
441 468
 				}
442
-				if($row<$rows-1 || $user->getHasFooter())
443
-					$writer->writeBreak();
469
+				if($row<$rows-1 || $user->getHasFooter()) {
470
+									$writer->writeBreak();
471
+				}
444 472
 			}
445 473
 		}
446 474
 
447
-		if($user->getHasFooter())
448
-			$this->renderFooter($writer,$user,$tableLayout,$totalColumns,false);
475
+		if($user->getHasFooter()) {
476
+					$this->renderFooter($writer,$user,$tableLayout,$totalColumns,false);
477
+		}
449 478
 
450 479
 	}
451 480
 
@@ -463,22 +492,24 @@  discard block
 block discarded – undo
463 492
 		{
464 493
 			$writer->renderBeginTag('thead');
465 494
 			$writer->renderBeginTag('tr');
466
-			if($columns>1)
467
-				$writer->addAttribute('colspan',"$columns");
495
+			if($columns>1) {
496
+							$writer->addAttribute('colspan',"$columns");
497
+			}
468 498
 			$writer->addAttribute('scope','col');
469
-			if(($style=$user->generateItemStyle('Header',-1))!==null)
470
-				$style->addAttributesToRender($writer);
499
+			if(($style=$user->generateItemStyle('Header',-1))!==null) {
500
+							$style->addAttributesToRender($writer);
501
+			}
471 502
 			$writer->renderBeginTag('th');
472 503
 			$user->renderItem($writer,$this,'Header',-1);
473 504
 			$writer->renderEndTag();
474 505
 			$writer->renderEndTag();
475 506
 			$writer->renderEndTag();
476
-		}
477
-		else
507
+		} else
478 508
 		{
479 509
 			$user->renderItem($writer,$this,'Header',-1);
480
-			if($needBreak)
481
-				$writer->writeBreak();
510
+			if($needBreak) {
511
+							$writer->writeBreak();
512
+			}
482 513
 		}
483 514
 		$writer->writeLine();
484 515
 	}
@@ -496,18 +527,20 @@  discard block
 block discarded – undo
496 527
 		{
497 528
 			$writer->renderBeginTag('tfoot');
498 529
 			$writer->renderBeginTag('tr');
499
-			if($columns>1)
500
-				$writer->addAttribute('colspan',"$columns");
501
-			if(($style=$user->generateItemStyle('Footer',-1))!==null)
502
-				$style->addAttributesToRender($writer);
530
+			if($columns>1) {
531
+							$writer->addAttribute('colspan',"$columns");
532
+			}
533
+			if(($style=$user->generateItemStyle('Footer',-1))!==null) {
534
+							$style->addAttributesToRender($writer);
535
+			}
503 536
 			$writer->renderBeginTag('td');
504 537
 			$user->renderItem($writer,$this,'Footer',-1);
505 538
 			$writer->renderEndTag();
506 539
 			$writer->renderEndTag();
507 540
 			$writer->renderEndTag();
541
+		} else {
542
+					$user->renderItem($writer,$this,'Footer',-1);
508 543
 		}
509
-		else
510
-			$user->renderItem($writer,$this,'Footer',-1);
511 544
 		$writer->writeLine();
512 545
 	}
513 546
 }
Please login to merge, or discard this patch.