Completed
Push — namespace2 ( fc6e2b...8a6673 )
by Fabio
08:49
created
framework/Web/UI/ActiveControls/TDraggable.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 *   o 'True' or 'Revert' : The draggable will revert to it's original position
54 54
 	 *   o 'False' or 'None' : The draggable won't revert to it's original position
55 55
 	 *   o 'Failure' : The draggable will only revert if it's dropped on a non droppable area
56
-	 * @return TDraggableRevertOption true to revert
56
+	 * @return string true to revert
57 57
 	 */
58 58
 	public function getRevert()
59 59
 	{
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 	/**
120 120
 	 * Determine if the element should be constrainted in one direction or not
121
-	 * @return CDraggableConstraint
121
+	 * @return string
122 122
 	 */
123 123
 	public function getConstraint()
124 124
 	{
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * Set the handle id or css class
33 33
 	 * @param string
34 34
 	 */
35
-	public function setHandle ($value)
35
+	public function setHandle($value)
36 36
 	{
37 37
 		$this->setViewState('DragHandle', TPropertyValue::ensureString($value), null);
38 38
 	}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * Get the handle id or css class
42 42
 	 * @return string
43 43
 	 */
44
-	public function getHandle ()
44
+	public function getHandle()
45 45
 	{
46 46
 		return $this->getViewState('DragHandle', null);
47 47
 	}
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public function setRevert($value)
73 73
 	{
74
-		if (strcasecmp($value,'true')==0 || $value===true)
74
+		if(strcasecmp($value, 'true')==0 || $value===true)
75 75
 			$value=TDraggableRevertOptions::Revert;
76
-		elseif (strcasecmp($value,'false')==0 || $value===false)
76
+		elseif(strcasecmp($value, 'false')==0 || $value===false)
77 77
 			$value=TDraggableRevertOptions::None;
78 78
 		$this->setViewState('Revert', TPropertyValue::ensureEnum($value, 'TDraggableRevertOptions'), true);
79 79
 	}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return TDraggableGhostingOption to clone the element
92 92
 	 */
93
-	public function getGhosting ()
93
+	public function getGhosting()
94 94
 	{
95 95
 		return $this->getViewState('Ghosting', TDraggableGhostingOptions::None);
96 96
 	}
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 	 *  o "False" or "None" means no Ghosting options
108 108
 	 *
109 109
 	 */
110
-	public function setGhosting ($value)
110
+	public function setGhosting($value)
111 111
 	{
112
-		if (strcasecmp($value,'true')==0 || $value===true)
112
+		if(strcasecmp($value, 'true')==0 || $value===true)
113 113
 			$value=TDraggableGhostingOptions::Ghosting;
114
-		elseif (strcasecmp($value,'false')==0 || $value===false)
114
+		elseif(strcasecmp($value, 'false')==0 || $value===false)
115 115
 			$value=TDraggableGhostingOptions::None;
116 116
 		$this->setViewState('Ghosting', TPropertyValue::ensureEnum($value, 'TDraggableGhostingOptions'), TDraggableGhostingOptions::None);
117 117
 	}
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 		parent::addAttributesToRender($writer);
155 155
 
156 156
 		$cs=$this->getPage()->getClientScript();
157
-		if ($this->getGhosting()==TDraggableGhostingOptions::SuperGhosting)
157
+		if($this->getGhosting()==TDraggableGhostingOptions::SuperGhosting)
158 158
 			$cs->registerPradoScript('dragdropextra');
159 159
 		else
160 160
 			$cs->registerPradoScript('dragdrop');
161
-		$writer->addAttribute('id',$this->getClientID());
161
+		$writer->addAttribute('id', $this->getClientID());
162 162
 		$options=TJavascript::encode($this->getPostBackOptions());
163 163
 		$class=$this->getClientClassName();
164 164
 		$code="new {$class}('{$this->getClientId()}', {$options}) ";
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * This method overrides the parent implementation.
171 171
 	 * @return string the javascript class name
172 172
 	 */
173
-	protected function getClientClassName ()
173
+	protected function getClientClassName()
174 174
 	{
175 175
 		return 'Draggable';
176 176
 	}
@@ -181,17 +181,17 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	protected function getPostBackOptions()
183 183
 	{
184
-		$options['ID'] = $this->getClientID();
184
+		$options['ID']=$this->getClientID();
185 185
 
186
-		if (($handle=$this->getHandle())!== null) $options['handle']=$handle;
187
-		if (($revert=$this->getRevert())===TDraggableRevertOptions::None)
186
+		if(($handle=$this->getHandle())!==null) $options['handle']=$handle;
187
+		if(($revert=$this->getRevert())===TDraggableRevertOptions::None)
188 188
 			$options['revert']=false;
189
-		elseif ($revert==TDraggableRevertOptions::Revert)
189
+		elseif($revert==TDraggableRevertOptions::Revert)
190 190
 			$options['revert']=true;
191 191
 		else
192 192
 			$options['revert']=strtolower($revert);
193
-		if (($constraint=$this->getConstraint())!==TDraggableConstraint::None) $options['constraint']=strtolower($constraint);
194
-		switch ($this->getGhosting())
193
+		if(($constraint=$this->getConstraint())!==TDraggableConstraint::None) $options['constraint']=strtolower($constraint);
194
+		switch($this->getGhosting())
195 195
 		{
196 196
 			case TDraggableGhostingOptions::SuperGhosting:
197 197
 				$options['superghosting']=true;
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TDropContainer.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -127,7 +127,6 @@
 block discarded – undo
127 127
 	 * Raises the onDrop event.
128 128
 	 * The drop parameters are encapsulated into a {@link TDropContainerEventParameter}
129 129
 	 *
130
-	 * @param object $dropControlId
131 130
 	 */
132 131
 	public function onDrop ($dropParams)
133 132
 	{
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
 		if ($this->sourcepath === NULL)
59 59
 		{
60 60
 			$this->sourcepath = $sourcepath;
61
-		}
62
-		else
61
+		} else
63 62
 		{
64 63
 			$this->sourcepath->append($sourcepath);
65 64
 		}
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @param object $dropControlId
139 139
 	 */
140
-	public function onDrop ($dropParams)
140
+	public function onDrop($dropParams)
141 141
 	{
142
-		$this->raiseEvent('OnDrop', $this, new TDropContainerEventParameter ($dropParams));
142
+		$this->raiseEvent('OnDrop', $this, new TDropContainerEventParameter($dropParams));
143 143
 
144 144
 	}
145 145
 
@@ -161,11 +161,11 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function getPostBackOptions()
163 163
 	{
164
-		$options['ID'] = $this->getClientID();
165
-		$options['EventTarget'] = $this->getUniqueID();
164
+		$options['ID']=$this->getClientID();
165
+		$options['EventTarget']=$this->getUniqueID();
166 166
 
167
-		$options['accept'] = $this->getAcceptCssClass();
168
-		$options['hoverclass'] = $this->getHoverCssClass();
167
+		$options['accept']=$this->getAcceptCssClass();
168
+		$options['hoverclass']=$this->getHoverCssClass();
169 169
 		return $options;
170 170
 	}
171 171
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	protected function addAttributesToRender($writer)
198 198
 	{
199 199
 		parent::addAttributesToRender($writer);
200
-		$writer->addAttribute('id',$this->getClientID());
200
+		$writer->addAttribute('id', $this->getClientID());
201 201
 
202 202
 		$this->getPage()->getClientScript()->registerPradoScript('dragdrop');
203 203
 		$this->getActiveControl()->registerCallbackClientScript(
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 	 * child controls. This container will be a TActivePanel, in order to allow user
211 211
 	 * to update its content on callback.
212 212
 	 */
213
-	public function createChildControls ()
213
+	public function createChildControls()
214 214
 	{
215
-		if ($this->_container===null)
215
+		if($this->_container===null)
216 216
 		{
217 217
 			$this->_container=Prado::CreateComponent('System.Web.UI.ActiveControls.TActivePanel');
218 218
 			$this->_container->setId($this->getId(false).'_content');
@@ -238,17 +238,17 @@  discard block
 block discarded – undo
238 238
 	 * is defered until OnPreRender event is raised.
239 239
 	 * @param THtmlWriter html writer
240 240
 	 */
241
-	public function render ($writer)
241
+	public function render($writer)
242 242
 	{
243 243
 		if($this->getHasPreRendered())
244 244
 		{
245 245
 			parent::render($writer);
246 246
 			if($this->getActiveControl()->canUpdateClientSide())
247
-				$this->getPage()->getCallbackClient()->replaceContent($this->_container,$writer);
247
+				$this->getPage()->getCallbackClient()->replaceContent($this->_container, $writer);
248 248
 		}
249 249
 		else
250 250
 		{
251
-			$this->getPage()->getAdapter()->registerControlToRender($this->_container,$writer);
251
+			$this->getPage()->getAdapter()->registerControlToRender($this->_container, $writer);
252 252
 		}
253 253
 	}
254 254
 }
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TInPlaceTextBox.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -92,6 +92,8 @@  discard block
 block discarded – undo
92 92
 	 * Calls the client-side static method for this control class.
93 93
 	 * @param string static method name
94 94
 	 * @param mixed method parmaeter
95
+	 * @param string $func
96
+	 * @param boolean $value
95 97
 	 */
96 98
 	protected function callClientFunction($func,$value)
97 99
 	{
@@ -239,6 +241,7 @@  discard block
 block discarded – undo
239 241
 	 * Raised when editing the content is requsted to be loaded from the
240 242
 	 * server side.
241 243
 	 * @param TCallbackEventParameter event parameter to be passed to the event handlers
244
+	 * @param TCallbackEventParameter $param
242 245
 	 */
243 246
 	public function onLoadingText($param)
244 247
 	{
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
 		if ($this->sourcepath === NULL)
59 59
 		{
60 60
 			$this->sourcepath = $sourcepath;
61
-		}
62
-		else
61
+		} else
63 62
 		{
64 63
 			$this->sourcepath->append($sourcepath);
65 64
 		}
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function setDisplayTextBox($value)
76 76
 	{
77
-		$value = TPropertyValue::ensureBoolean($value);
78
-		$this->setViewState('DisplayTextBox', $value,false);
77
+		$value=TPropertyValue::ensureBoolean($value);
78
+		$this->setViewState('DisplayTextBox', $value, false);
79 79
 		if($this->getActiveControl()->canUpdateClientSide())
80
-			$this->callClientFunction('setDisplayTextBox',$value);
80
+			$this->callClientFunction('setDisplayTextBox', $value);
81 81
 	}
82 82
 
83 83
 	/**
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 	 * @param string static method name
94 94
 	 * @param mixed method parmaeter
95 95
 	 */
96
-	protected function callClientFunction($func,$value)
96
+	protected function callClientFunction($func, $value)
97 97
 	{
98
-		$client = $this->getPage()->getCallbackClient();
99
-		$code = $this->getClientClassName().'.'.$func;
100
-		$client->callClientFunction($code,array($this,$value));
98
+		$client=$this->getPage()->getCallbackClient();
99
+		$code=$this->getClientClassName().'.'.$func;
100
+		$client->callClientFunction($code, array($this, $value));
101 101
 	}
102 102
 
103 103
 	/**
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	protected function getExternalControlID()
123 123
 	{
124
-		$extID = $this->getEditTriggerControlID();
124
+		$extID=$this->getEditTriggerControlID();
125 125
 		if($extID===null) return '';
126
-		if(($control = $this->findControl($extID))!==null)
126
+		if(($control=$this->findControl($extID))!==null)
127 127
 			return $control->getClientID();
128 128
 		return $extID;
129 129
 	}
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function setText($value)
137 137
 	{
138
-		if(TTextBox::getText() === $value)
138
+		if(TTextBox::getText()===$value)
139 139
 			return;
140 140
 
141 141
 		TTextBox::setText($value);
142 142
 		if($this->getActiveControl()->canUpdateClientSide())
143 143
 		{
144
-			$client = $this->getPage()->getCallbackClient();
144
+			$client=$this->getPage()->getCallbackClient();
145 145
 			$client->update($this->getLabelClientID(), $value);
146 146
 			$client->setValue($this, $value);
147 147
 		}
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
 	 * @param boolean value
153 153
 	 * @since 3.1.2
154 154
 	 */
155
-	public function setReadOnly ($value)
155
+	public function setReadOnly($value)
156 156
 	{
157 157
 		$value=TPropertyValue::ensureBoolean($value);
158
-		if(TTextBox::getReadOnly() === $value)
158
+		if(TTextBox::getReadOnly()===$value)
159 159
 			return;
160 160
 
161 161
 		TTextBox::setReadOnly($value);
162
-		if ($this->getActiveControl()->canUpdateClientSide())
162
+		if($this->getActiveControl()->canUpdateClientSide())
163 163
 		{
164 164
 			$this->callClientFunction('setReadOnly', $value);
165 165
 		}
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	public function onCallback($param)
204 204
 	{
205
-		$action = $param->getCallbackParameter();
206
-		if(is_array($action) && $action[0] === '__InlineEditor_loadExternalText__')
205
+		$action=$param->getCallbackParameter();
206
+		if(is_array($action) && $action[0]==='__InlineEditor_loadExternalText__')
207 207
 		{
208
-			$parameter = new TCallbackEventParameter($this->getResponse(), $action[1]);
208
+			$parameter=new TCallbackEventParameter($this->getResponse(), $action[1]);
209 209
 			$this->onLoadingText($parameter);
210 210
 		}
211 211
 		$this->raiseEvent('OnCallback', $this, $param);
@@ -216,26 +216,26 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	protected function getPostBackOptions()
218 218
 	{
219
-		$options = parent::getPostBackOptions();
220
-		$options['ID'] = $this->getLabelClientID();
221
-		$options['TextBoxID'] = $this->getClientID();
222
-		$options['ExternalControl'] = $this->getExternalControlID();
223
-		$options['AutoHide'] = $this->getAutoHideTextBox() == false ? '' : true;
224
-		$options['AutoPostBack'] = $this->getAutoPostBack() == false ? '' : true;
225
-		$options['Columns'] = $this->getColumns();
219
+		$options=parent::getPostBackOptions();
220
+		$options['ID']=$this->getLabelClientID();
221
+		$options['TextBoxID']=$this->getClientID();
222
+		$options['ExternalControl']=$this->getExternalControlID();
223
+		$options['AutoHide']=$this->getAutoHideTextBox()==false ? '' : true;
224
+		$options['AutoPostBack']=$this->getAutoPostBack()==false ? '' : true;
225
+		$options['Columns']=$this->getColumns();
226 226
 		if($this->getTextMode()==='MultiLine')
227 227
 		{
228
-			$options['Rows'] = $this->getRows();
229
-			$options['Wrap'] = $this->getWrap()== false ? '' : true;
228
+			$options['Rows']=$this->getRows();
229
+			$options['Wrap']=$this->getWrap()==false ? '' : true;
230 230
 		}
231 231
 		else
232 232
 		{
233
-			$length = $this->getMaxLength();
234
-			$options['MaxLength'] = $length > 0 ? $length : '';
233
+			$length=$this->getMaxLength();
234
+			$options['MaxLength']=$length > 0 ? $length : '';
235 235
 		}
236 236
 
237 237
 		if($this->hasEventHandler('OnLoadingText'))
238
-			$options['LoadTextOnEdit'] = true;
238
+			$options['LoadTextOnEdit']=true;
239 239
 
240 240
 		$options['ReadOnly']=$this->getReadOnly();
241 241
 		return $options;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	public function onLoadingText($param)
250 250
 	{
251
-		$this->raiseEvent('OnLoadingText',$this,$param);
251
+		$this->raiseEvent('OnLoadingText', $this, $param);
252 252
 	}
253 253
 
254 254
 	/**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	{
268 268
 		//calls the TWebControl to avoid rendering other attribute normally render for a textbox.
269 269
 		TWebControl::addAttributesToRender($writer);
270
-		$writer->addAttribute('id',$this->getLabelClientID());
270
+		$writer->addAttribute('id', $this->getLabelClientID());
271 271
 		$this->getActiveControl()->registerCallbackClientScript(
272 272
 			$this->getClientClassName(), $this->getPostBackOptions());
273 273
 	}
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TTriggeredCallback.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 	}
57 57
 
58 58
 	/**
59
-	 * @return array list of trigger callback options.
59
+	 * @return string list of trigger callback options.
60 60
 	 */
61 61
 	protected function getTriggerOptions()
62 62
 	{
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	protected function getTargetControl()
46 46
 	{
47
-		$id = $this->getControlID();
47
+		$id=$this->getControlID();
48 48
 		if(($control=$this->findControl($id)) instanceof TControl)
49 49
 			return $control->getClientID();
50 50
 		if($id==='')
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	protected function getTriggerOptions()
62 62
 	{
63
-		$options['ID'] = $this->getClientID();
64
-		$options['EventTarget'] = $this->getUniqueID();
65
-		$options['ControlID'] = $this->getTargetControl();
63
+		$options['ID']=$this->getClientID();
64
+		$options['EventTarget']=$this->getUniqueID();
65
+		$options['ControlID']=$this->getTargetControl();
66 66
 		return $options;
67 67
 	}
68 68
 }
Please login to merge, or discard this patch.
framework/Web/UI/JuiControls/TJuiDialog.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -158,6 +158,9 @@
 block discarded – undo
158 158
 		$this->triggerClientMethod('close');
159 159
 	}
160 160
 
161
+	/**
162
+	 * @param string $method
163
+	 */
161 164
 	private function triggerClientMethod($method)
162 165
 	{
163 166
 		$cs = $this->getPage()->getClientScript();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
 		if ($this->sourcepath === NULL)
59 59
 		{
60 60
 			$this->sourcepath = $sourcepath;
61
-		}
62
-		else
61
+		} else
63 62
 		{
64 63
 			$this->sourcepath->append($sourcepath);
65 64
 		}
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function getOptions()
70 70
 	{
71
-		if (($options=$this->getViewState('JuiOptions'))===null)
71
+		if(($options=$this->getViewState('JuiOptions'))===null)
72 72
 		{
73 73
 		  $options=new TJuiControlOptions($this);
74 74
 		  $this->setViewState('JuiOptions', $options);
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	protected function getPostBackOptions()
101 101
 	{
102
-		$options = $this->getOptions()->toArray();
102
+		$options=$this->getOptions()->toArray();
103 103
 		// always make the dialog a child of the form, or its inner inputs won't be collected
104 104
 		if(!isset($options['appendTo']))
105
-			$options['appendTo'] = 'form:first';
105
+			$options['appendTo']='form:first';
106 106
 
107 107
 		foreach($this->getControls() as $control)
108 108
 			if($control instanceof TJuiDialogButton)
109
-				$options['buttons'][] = $control->getPostBackOptions();
109
+				$options['buttons'][]=$control->getPostBackOptions();
110 110
 
111 111
 		return $options;
112 112
 	}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	{
120 120
 		parent::addAttributesToRender($writer);
121 121
 
122
-		$writer->addAttribute('id',$this->getClientID());
122
+		$writer->addAttribute('id', $this->getClientID());
123 123
 		$options=TJavascript::encode($this->getPostBackOptions());
124 124
 		$cs=$this->getPage()->getClientScript();
125 125
 		$code="jQuery('#".$this->getWidgetID()."').".$this->getWidget()."(".$options.");";
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 * Raises the OnCreate event
141 141
 	 * @param object $params event parameters
142 142
 	 */
143
-	public function onOpen ($params)
143
+	public function onOpen($params)
144 144
 	{
145 145
 		$this->raiseEvent('OnOpen', $this, $params);
146 146
 	}
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 
164 164
 	private function triggerClientMethod($method)
165 165
 	{
166
-		$cs = $this->getPage()->getClientScript();
167
-		$code = "jQuery(document).ready(function() { jQuery('#".$this->getClientId()."').dialog('".$method."'); })";
166
+		$cs=$this->getPage()->getClientScript();
167
+		$code="jQuery(document).ready(function() { jQuery('#".$this->getClientId()."').dialog('".$method."'); })";
168 168
 		$cs->registerEndScript(sprintf('%08X', crc32($code)), $code);
169 169
 	}
170 170
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 		return array(
245 245
 			'text' => $this->getText(),
246 246
 			'click' => new TJavaScriptLiteral("function(){new Prado.Callback('".$this->getUniqueID()."', 'onClick');}"
247
-			)) ;
247
+			));
248 248
 	}
249 249
 
250 250
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	public function getText()
254 254
 	{
255
-		return $this->getViewState('Text','');
255
+		return $this->getViewState('Text', '');
256 256
 	}
257 257
 
258 258
 	/**
@@ -260,14 +260,14 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function setText($value)
262 262
 	{
263
-		$this->setViewState('Text',$value,'');
263
+		$this->setViewState('Text', $value, '');
264 264
 	}
265 265
 
266 266
 	/**
267 267
 	 * Raises the OnClick event
268 268
 	 * @param object $params event parameters
269 269
 	 */
270
-	public function onClick ($params)
270
+	public function onClick($params)
271 271
 	{
272 272
 		$this->raiseEvent('OnClick', $this, $params);
273 273
 	}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function raiseCallbackEvent($param)
281 281
 	{
282
-		if($param->CallbackParameter === 'onClick')
282
+		if($param->CallbackParameter==='onClick')
283 283
 			$this->onClick($param);
284 284
 	}
285 285
 
Please login to merge, or discard this patch.
framework/Web/UI/TTemplateControlInheritable.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
 	/**
77 77
 	 * This method creates the template object for the given class
78 78
 	 *
79
-	 * @param string $p_class The class to create the template from
79
+	 * @param string $parentClass
80 80
 	 * @return void
81 81
 	 * @throws TConfigurationException if a template control directive is invalid
82 82
 	 */
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */	
44 44
 	public function createChildControls()
45 45
 	{
46
-		if(null === ($_template = $this->getTemplate())) {
46
+		if(null===($_template=$this->getTemplate())) {
47 47
 			return $this->doCreateChildControlsFor(get_class($this));
48 48
 		}
49 49
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function doCreateChildControlsFor($parentClass)
68 68
 	{
69
-		if(false !== ($_parentClass = get_parent_class($parentClass)) && 'TTemplateControl' != $_parentClass) {
69
+		if(false!==($_parentClass=get_parent_class($parentClass)) && 'TTemplateControl'!=$_parentClass) {
70 70
 			$this->doCreateChildControlsFor($_parentClass);
71 71
 		}
72 72
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function doTemplateForClass($parentClass)
84 84
 	{
85
-		if(null !== ($_template = $this->getService()->getTemplateManager()->getTemplateByClassName($parentClass))) {
85
+		if(null!==($_template=$this->getService()->getTemplateManager()->getTemplateByClassName($parentClass))) {
86 86
 			foreach($_template->getDirective() as $_name => $_value) {
87 87
 				if(!is_string($_value)) {
88 88
 					throw new TConfigurationException('templatecontrol_directive_invalid', get_class(this), $_name);
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function getIsSourceTemplateControl()
107 107
 	{
108
-		if(null !== ($_template = $this->getTemplate())) {
108
+		if(null!==($_template=$this->getTemplate())) {
109 109
 			return $_template->getIsSourceTemplate();
110 110
 		}
111 111
 
112
-		return ($_template = $this->getService()->getTemplateManager()->getTemplateByClassName(get_parent_class($this)))
112
+		return ($_template=$this->getService()->getTemplateManager()->getTemplateByClassName(get_parent_class($this)))
113 113
 			? $_template->getIsSourceTemplate()
114 114
 			: false;
115 115
 	}
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TBaseDataList.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -166,6 +166,7 @@
 block discarded – undo
166 166
 	 * Otherwise, an exception will be raised.
167 167
 	 * @param mixed data item
168 168
 	 * @param mixed field name
169
+	 * @param string $field
169 170
 	 * @return mixed data value at the specified field
170 171
 	 * @throws TInvalidDataValueException if the data is invalid
171 172
 	 */
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function getDataKeyField()
136 136
 	{
137
-		return $this->getViewState('DataKeyField','');
137
+		return $this->getViewState('DataKeyField', '');
138 138
 	}
139 139
 
140 140
 	/**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	public function setDataKeyField($value)
144 144
 	{
145
-		$this->setViewState('DataKeyField',$value,'');
145
+		$this->setViewState('DataKeyField', $value, '');
146 146
 	}
147 147
 
148 148
 	/**
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	public function getDataKeys()
152 152
 	{
153
-		if(($dataKeys=$this->getViewState('DataKeys',null))===null)
153
+		if(($dataKeys=$this->getViewState('DataKeys', null))===null)
154 154
 		{
155 155
 			$dataKeys=new TList;
156
-			$this->setViewState('DataKeys',$dataKeys,null);
156
+			$this->setViewState('DataKeys', $dataKeys, null);
157 157
 		}
158 158
 		return $dataKeys;
159 159
 	}
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
 	 * @return mixed data value at the specified field
170 170
 	 * @throws TInvalidDataValueException if the data is invalid
171 171
 	 */
172
-	protected function getDataFieldValue($data,$field)
172
+	protected function getDataFieldValue($data, $field)
173 173
 	{
174
-		return TDataFieldAccessor::getDataFieldValue($data,$field);
174
+		return TDataFieldAccessor::getDataFieldValue($data, $field);
175 175
 	}
176 176
 
177 177
 	/**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	public function onSelectedIndexChanged($param)
184 184
 	{
185
-		$this->raiseEvent('OnSelectedIndexChanged',$this,$param);
185
+		$this->raiseEvent('OnSelectedIndexChanged', $this, $param);
186 186
 	}
187 187
 }
188 188
 
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TButton.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -218,6 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * If you override this method, be sure to call the parent implementation
219 219
 	 * so that the event handlers can be invoked.
220 220
 	 * @param TCommandEventParameter event parameter to be passed to the event handlers
221
+	 * @param TCommandEventParameter $param
221 222
 	 */
222 223
 	public function onCommand($param)
223 224
 	{
@@ -342,6 +343,7 @@  discard block
 block discarded – undo
342 343
 
343 344
 	/**
344 345
 	 * @param string the group of validators which the button causes validation upon postback
346
+	 * @param string $value
345 347
 	 */
346 348
 	public function setValidationGroup($value)
347 349
 	{
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -106,8 +106,7 @@  discard block
 block discarded – undo
106 106
 		{
107 107
 			if($this->getEnableClientScript() && $this->needPostBackScript())
108 108
 				$this->renderClientControlScript($writer);
109
-		}
110
-		else if($this->getEnabled()) // in this case, parent will not render 'disabled'
109
+		} else if($this->getEnabled()) // in this case, parent will not render 'disabled'
111 110
 			$writer->addAttribute('disabled','disabled');
112 111
 		parent::addAttributesToRender($writer);
113 112
 	}
@@ -141,8 +140,7 @@  discard block
 block discarded – undo
141 140
 		{
142 141
 			$group=$this->getValidationGroup();
143 142
 			return $this->getPage()->getValidators($group)->getCount()>0;
144
-		}
145
-		else
143
+		} else
146 144
 			return false;
147 145
 	}
148 146
 
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public function getButtonTag()
66 66
 	{
67
-		return $this->getViewState('ButtonTag',TButtonTag::Input);
67
+		return $this->getViewState('ButtonTag', TButtonTag::Input);
68 68
 	}
69 69
 
70 70
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function setButtonTag($value)
74 74
 	{
75
-		$this->setViewState('ButtonTag',TPropertyValue::ensureEnum($value,'TButtonTag'),TButtonTag::Input);
75
+		$this->setViewState('ButtonTag', TPropertyValue::ensureEnum($value, 'TButtonTag'), TButtonTag::Input);
76 76
 	}
77 77
 
78 78
 	/**
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function getEnableClientScript()
82 82
 	{
83
-		return $this->getViewState('EnableClientScript',true);
83
+		return $this->getViewState('EnableClientScript', true);
84 84
 	}
85 85
 
86 86
 	/**
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function setEnableClientScript($value)
90 90
 	{
91
-		$this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true);
91
+		$this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true);
92 92
 	}
93 93
 
94 94
 	/**
@@ -100,20 +100,20 @@  discard block
 block discarded – undo
100 100
 	{
101 101
 		$page=$this->getPage();
102 102
 		$page->ensureRenderInForm($this);
103
-		$writer->addAttribute('type',strtolower($this->getButtonType()));
103
+		$writer->addAttribute('type', strtolower($this->getButtonType()));
104 104
 		if(($uniqueID=$this->getUniqueID())!=='')
105
-			$writer->addAttribute('name',$uniqueID);
105
+			$writer->addAttribute('name', $uniqueID);
106 106
 		if($this->getButtonTag()===TButtonTag::Button)
107 107
 		  $this->addParsedObject($this->getText());
108 108
 		else
109
-		  $writer->addAttribute('value',$this->getText());
109
+		  $writer->addAttribute('value', $this->getText());
110 110
 		if($this->getEnabled(true))
111 111
 		{
112 112
 			if($this->getEnableClientScript() && $this->needPostBackScript())
113 113
 				$this->renderClientControlScript($writer);
114 114
 		}
115 115
 		else if($this->getEnabled()) // in this case, parent will not render 'disabled'
116
-			$writer->addAttribute('disabled','disabled');
116
+			$writer->addAttribute('disabled', 'disabled');
117 117
 
118 118
 		parent::addAttributesToRender($writer);
119 119
 	}
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	protected function renderClientControlScript($writer)
125 125
 	{
126
-		$writer->addAttribute('id',$this->getClientID());
127
-		$this->getPage()->getClientScript()->registerPostBackControl($this->getClientClassName(),$this->getPostBackOptions());
126
+		$writer->addAttribute('id', $this->getClientID());
127
+		$this->getPage()->getClientScript()->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions());
128 128
 	}
129 129
 
130 130
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		if($this->getCausesValidation())
146 146
 		{
147 147
 			$group=$this->getValidationGroup();
148
-			return $this->getPage()->getValidators($group)->getCount()>0;
148
+			return $this->getPage()->getValidators($group)->getCount() > 0;
149 149
 		}
150 150
 		else
151 151
 			return false;
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	public function setIsDefaultButton($value)
158 158
 	{
159
-		$this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value),false);
159
+		$this->setViewState('IsDefaultButton', TPropertyValue::ensureBoolean($value), false);
160 160
 	}
161 161
 
162 162
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	{
187 187
 		$options['ID']=$this->getClientID();
188 188
 		$options['CausesValidation']=$this->getCausesValidation();
189
-		$options['EventTarget'] = $this->getUniqueID();
189
+		$options['EventTarget']=$this->getUniqueID();
190 190
 		$options['ValidationGroup']=$this->getValidationGroup();
191 191
 
192 192
 		return $options;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	public function onClick($param)
215 215
 	{
216
-		$this->raiseEvent('OnClick',$this,$param);
216
+		$this->raiseEvent('OnClick', $this, $param);
217 217
 	}
218 218
 
219 219
 	/**
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public function onCommand($param)
227 227
 	{
228
-		$this->raiseEvent('OnCommand',$this,$param);
229
-		$this->raiseBubbleEvent($this,$param);
228
+		$this->raiseEvent('OnCommand', $this, $param);
229
+		$this->raiseBubbleEvent($this, $param);
230 230
 	}
231 231
 
232 232
 	/**
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 		if($this->getCausesValidation())
244 244
 			$this->getPage()->validate($this->getValidationGroup());
245 245
 		$this->onClick(null);
246
-		$this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(),$this->getCommandParameter()));
246
+		$this->onCommand(new \Prado\Web\UI\TCommandEventParameter($this->getCommandName(), $this->getCommandParameter()));
247 247
 	}
248 248
 
249 249
 	/**
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 */
252 252
 	public function getText()
253 253
 	{
254
-		return $this->getViewState('Text','');
254
+		return $this->getViewState('Text', '');
255 255
 	}
256 256
 
257 257
 	/**
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	public function setText($value)
261 261
 	{
262
-		$this->setViewState('Text',$value,'');
262
+		$this->setViewState('Text', $value, '');
263 263
 	}
264 264
 
265 265
 	/**
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	public function getCausesValidation()
295 295
 	{
296
-		return $this->getViewState('CausesValidation',true);
296
+		return $this->getViewState('CausesValidation', true);
297 297
 	}
298 298
 
299 299
 	/**
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	public function setCausesValidation($value)
303 303
 	{
304
-		$this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true);
304
+		$this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true);
305 305
 	}
306 306
 
307 307
 	/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	public function getCommandName()
311 311
 	{
312
-		return $this->getViewState('CommandName','');
312
+		return $this->getViewState('CommandName', '');
313 313
 	}
314 314
 
315 315
 	/**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public function setCommandName($value)
319 319
 	{
320
-		$this->setViewState('CommandName',$value,'');
320
+		$this->setViewState('CommandName', $value, '');
321 321
 	}
322 322
 
323 323
 	/**
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 */
326 326
 	public function getCommandParameter()
327 327
 	{
328
-		return $this->getViewState('CommandParameter','');
328
+		return $this->getViewState('CommandParameter', '');
329 329
 	}
330 330
 
331 331
 	/**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	 */
334 334
 	public function setCommandParameter($value)
335 335
 	{
336
-		$this->setViewState('CommandParameter',$value,'');
336
+		$this->setViewState('CommandParameter', $value, '');
337 337
 	}
338 338
 
339 339
 	/**
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 */
342 342
 	public function getValidationGroup()
343 343
 	{
344
-		return $this->getViewState('ValidationGroup','');
344
+		return $this->getViewState('ValidationGroup', '');
345 345
 	}
346 346
 
347 347
 	/**
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	 */
350 350
 	public function setValidationGroup($value)
351 351
 	{
352
-		$this->setViewState('ValidationGroup',$value,'');
352
+		$this->setViewState('ValidationGroup', $value, '');
353 353
 	}
354 354
 
355 355
 	/**
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	public function getButtonType()
359 359
 	{
360
-		return $this->getViewState('ButtonType',TButtonType::Submit);
360
+		return $this->getViewState('ButtonType', TButtonType::Submit);
361 361
 	}
362 362
 
363 363
 	/**
@@ -365,6 +365,6 @@  discard block
 block discarded – undo
365 365
 	 */
366 366
 	public function setButtonType($value)
367 367
 	{
368
-		$this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'Prado\\Web\\UI\\WebControls\\TButtonType'),TButtonType::Submit);
368
+		$this->setViewState('ButtonType', TPropertyValue::ensureEnum($value, 'Prado\\Web\\UI\\WebControls\\TButtonType'), TButtonType::Submit);
369 369
 	}
370 370
 }
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TCaptcha.php 2 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -267,6 +267,7 @@  discard block
 block discarded – undo
267 267
 
268 268
 	/**
269 269
 	 * @param string the public key used for generating the token. A random one will be generated if this is not set.
270
+	 * @param string $value
270 271
 	 */
271 272
 	public function setPublicKey($value)
272 273
 	{
@@ -322,6 +323,7 @@  discard block
 block discarded – undo
322 323
 	/**
323 324
 	 * Validates a user input with the token.
324 325
 	 * @param string user input
326
+	 * @param string $input
325 327
 	 * @return boolean if the user input is not the same as the token.
326 328
 	 */
327 329
 	public function validate($input)
@@ -447,6 +449,11 @@  discard block
 block discarded – undo
447 449
 	 * @param string private key
448 450
 	 * @param integer the length of the token
449 451
 	 * @param boolean whether the token is case sensitive
452
+	 * @param string $publicKey
453
+	 * @param string $privateKey
454
+	 * @param string $alphabet
455
+	 * @param integer $tokenLength
456
+	 * @param boolean $caseSensitive
450 457
 	 * @return string the token generated.
451 458
 	 */
452 459
 	protected function generateToken($publicKey,$privateKey,$alphabet,$tokenLength,$caseSensitive)
@@ -459,6 +466,7 @@  discard block
 block discarded – undo
459 466
 	 * Converts a hash string into a string with characters consisting of alphanumeric characters.
460 467
 	 * @param string the hexadecimal representation of the hash string
461 468
 	 * @param string the alphabet used to represent the converted string. If empty, it means '234578adefhijmnrtwyABDEFGHIJLMNQRTWY', which excludes those confusing characters.
469
+	 * @param string $hex
462 470
 	 * @return string the converted string
463 471
 	 */
464 472
 	protected function hash2string($hex,$alphabet='')
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public function getTokenImageTheme()
73 73
 	{
74
-		return $this->getViewState('TokenImageTheme',0);
74
+		return $this->getViewState('TokenImageTheme', 0);
75 75
 	}
76 76
 
77 77
 	/**
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	public function setTokenImageTheme($value)
91 91
 	{
92 92
 		$value=TPropertyValue::ensureInteger($value);
93
-		if($value>=0 && $value<=63)
94
-			$this->setViewState('TokenImageTheme',$value,0);
93
+		if($value >= 0 && $value <= 63)
94
+			$this->setViewState('TokenImageTheme', $value, 0);
95 95
 		else
96
-			throw new TConfigurationException('captcha_tokenimagetheme_invalid',0,63);
96
+			throw new TConfigurationException('captcha_tokenimagetheme_invalid', 0, 63);
97 97
 	}
98 98
 
99 99
 	/**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function getTokenFontSize()
103 103
 	{
104
-		return $this->getViewState('TokenFontSize',30);
104
+		return $this->getViewState('TokenFontSize', 30);
105 105
 	}
106 106
 
107 107
 	/**
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 	public function setTokenFontSize($value)
114 114
 	{
115 115
 		$value=TPropertyValue::ensureInteger($value);
116
-		if($value>=20 && $value<=100)
117
-			$this->setViewState('TokenFontSize',$value,30);
116
+		if($value >= 20 && $value <= 100)
117
+			$this->setViewState('TokenFontSize', $value, 30);
118 118
 		else
119
-			throw new TConfigurationException('captcha_tokenfontsize_invalid',20,100);
119
+			throw new TConfigurationException('captcha_tokenfontsize_invalid', 20, 100);
120 120
 	}
121 121
 
122 122
 	/**
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function getMinTokenLength()
126 126
 	{
127
-		return $this->getViewState('MinTokenLength',4);
127
+		return $this->getViewState('MinTokenLength', 4);
128 128
 	}
129 129
 
130 130
 	/**
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	public function setMinTokenLength($value)
134 134
 	{
135 135
 		$length=TPropertyValue::ensureInteger($value);
136
-		if($length>=self::MIN_TOKEN_LENGTH && $length<=self::MAX_TOKEN_LENGTH)
137
-			$this->setViewState('MinTokenLength',$length,4);
136
+		if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH)
137
+			$this->setViewState('MinTokenLength', $length, 4);
138 138
 		else
139
-			throw new TConfigurationException('captcha_mintokenlength_invalid',self::MIN_TOKEN_LENGTH,self::MAX_TOKEN_LENGTH);
139
+			throw new TConfigurationException('captcha_mintokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH);
140 140
 	}
141 141
 
142 142
 	/**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function getMaxTokenLength()
146 146
 	{
147
-		return $this->getViewState('MaxTokenLength',6);
147
+		return $this->getViewState('MaxTokenLength', 6);
148 148
 	}
149 149
 
150 150
 	/**
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 	public function setMaxTokenLength($value)
154 154
 	{
155 155
 		$length=TPropertyValue::ensureInteger($value);
156
-		if($length>=self::MIN_TOKEN_LENGTH && $length<=self::MAX_TOKEN_LENGTH)
157
-			$this->setViewState('MaxTokenLength',$length,6);
156
+		if($length >= self::MIN_TOKEN_LENGTH && $length <= self::MAX_TOKEN_LENGTH)
157
+			$this->setViewState('MaxTokenLength', $length, 6);
158 158
 		else
159
-			throw new TConfigurationException('captcha_maxtokenlength_invalid',self::MIN_TOKEN_LENGTH,self::MAX_TOKEN_LENGTH);
159
+			throw new TConfigurationException('captcha_maxtokenlength_invalid', self::MIN_TOKEN_LENGTH, self::MAX_TOKEN_LENGTH);
160 160
 	}
161 161
 
162 162
 	/**
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	public function getCaseSensitive()
166 166
 	{
167
-		return $this->getViewState('CaseSensitive',true);
167
+		return $this->getViewState('CaseSensitive', true);
168 168
 	}
169 169
 
170 170
 	/**
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 */
173 173
 	public function setCaseSensitive($value)
174 174
 	{
175
-		$this->setViewState('CaseSensitive',TPropertyValue::ensureBoolean($value),true);
175
+		$this->setViewState('CaseSensitive', TPropertyValue::ensureBoolean($value), true);
176 176
 	}
177 177
 
178 178
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function getTokenAlphabet()
182 182
 	{
183
-		return $this->getViewState('TokenAlphabet','234578adefhijmnrtABDEFGHJLMNRT');
183
+		return $this->getViewState('TokenAlphabet', '234578adefhijmnrtABDEFGHJLMNRT');
184 184
 	}
185 185
 
186 186
 	/**
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	public function setTokenAlphabet($value)
190 190
 	{
191
-		if(strlen($value)<2)
191
+		if(strlen($value) < 2)
192 192
 			throw new TConfigurationException('captcha_tokenalphabet_invalid');
193
-		$this->setViewState('TokenAlphabet',$value,'234578adefhijmnrtABDEFGHJLMNRT');
193
+		$this->setViewState('TokenAlphabet', $value, '234578adefhijmnrtABDEFGHJLMNRT');
194 194
 	}
195 195
 
196 196
 	/**
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function getTokenExpiry()
200 200
 	{
201
-		return $this->getViewState('TokenExpiry',600);
201
+		return $this->getViewState('TokenExpiry', 600);
202 202
 	}
203 203
 
204 204
 	/**
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function setTokenExpiry($value)
208 208
 	{
209
-		$this->setViewState('TokenExpiry',TPropertyValue::ensureInteger($value),600);
209
+		$this->setViewState('TokenExpiry', TPropertyValue::ensureInteger($value), 600);
210 210
 	}
211 211
 
212 212
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	public function getChangingTokenBackground()
216 216
 	{
217
-		return $this->getViewState('ChangingTokenBackground',false);
217
+		return $this->getViewState('ChangingTokenBackground', false);
218 218
 	}
219 219
 
220 220
 	/**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	public function setChangingTokenBackground($value)
224 224
 	{
225
-		$this->setViewState('ChangingTokenBackground',TPropertyValue::ensureBoolean($value),false);
225
+		$this->setViewState('ChangingTokenBackground', TPropertyValue::ensureBoolean($value), false);
226 226
 	}
227 227
 
228 228
 	/**
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	public function getTestLimit()
232 232
 	{
233
-		return $this->getViewState('TestLimit',5);
233
+		return $this->getViewState('TestLimit', 5);
234 234
 	}
235 235
 
236 236
 	/**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	public function setTestLimit($value)
240 240
 	{
241
-		$this->setViewState('TestLimit',TPropertyValue::ensureInteger($value),5);
241
+		$this->setViewState('TestLimit', TPropertyValue::ensureInteger($value), 5);
242 242
 	}
243 243
 
244 244
 	/**
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public function getIsTokenExpired()
248 248
 	{
249
-		if(($expiry=$this->getTokenExpiry())>0 && ($start=$this->getViewState('TokenGenerated',0))>0)
250
-			return $expiry+$start<time();
249
+		if(($expiry=$this->getTokenExpiry()) > 0 && ($start=$this->getViewState('TokenGenerated', 0)) > 0)
250
+			return $expiry + $start < time();
251 251
 		else
252 252
 			return false;
253 253
 	}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	public function getPublicKey()
259 259
 	{
260
-		if(($publicKey=$this->getViewState('PublicKey',''))==='')
260
+		if(($publicKey=$this->getViewState('PublicKey', ''))==='')
261 261
 		{
262 262
 			$publicKey=$this->generateRandomKey();
263 263
 			$this->setPublicKey($publicKey);
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 */
271 271
 	public function setPublicKey($value)
272 272
 	{
273
-		$this->setViewState('PublicKey',$value,'');
273
+		$this->setViewState('PublicKey', $value, '');
274 274
 	}
275 275
 
276 276
 	/**
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	public function getToken()
280 280
 	{
281
-		return $this->generateToken($this->getPublicKey(),$this->getPrivateKey(),$this->getTokenAlphabet(),$this->getTokenLength(),$this->getCaseSensitive());
281
+		return $this->generateToken($this->getPublicKey(), $this->getPrivateKey(), $this->getTokenAlphabet(), $this->getTokenLength(), $this->getCaseSensitive());
282 282
 	}
283 283
 
284 284
 	/**
@@ -290,13 +290,13 @@  discard block
 block discarded – undo
290 290
 		{
291 291
 			$minLength=$this->getMinTokenLength();
292 292
 			$maxLength=$this->getMaxTokenLength();
293
-			if($minLength>$maxLength)
294
-				$tokenLength=rand($maxLength,$minLength);
295
-			else if($minLength<$maxLength)
296
-				$tokenLength=rand($minLength,$maxLength);
293
+			if($minLength > $maxLength)
294
+				$tokenLength=rand($maxLength, $minLength);
295
+			else if($minLength < $maxLength)
296
+				$tokenLength=rand($minLength, $maxLength);
297 297
 			else
298 298
 				$tokenLength=$minLength;
299
-			$this->setViewState('TokenLength',$tokenLength);
299
+			$this->setViewState('TokenLength', $tokenLength);
300 300
 		}
301 301
 		return $tokenLength;
302 302
 	}
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 			$fileName=$this->generatePrivateKeyFile();
312 312
 			$content=file_get_contents($fileName);
313 313
 			$matches=array();
314
-			if(preg_match("/privateKey='(.*?)'/ms",$content,$matches)>0)
314
+			if(preg_match("/privateKey='(.*?)'/ms", $content, $matches) > 0)
315 315
 				$this->_privateKey=$matches[1];
316 316
 			else
317 317
 				throw new TConfigurationException('captcha_privatekey_unknown');
@@ -326,18 +326,18 @@  discard block
 block discarded – undo
326 326
 	 */
327 327
 	public function validate($input)
328 328
 	{
329
-		$number=$this->getViewState('TestNumber',0);
329
+		$number=$this->getViewState('TestNumber', 0);
330 330
 		if(!$this->_validated)
331 331
 		{
332
-			$this->setViewState('TestNumber',++$number);
332
+			$this->setViewState('TestNumber', ++$number);
333 333
 			$this->_validated=true;
334 334
 		}
335
-		if($this->getIsTokenExpired() || (($limit=$this->getTestLimit())>0 && $number>$limit))
335
+		if($this->getIsTokenExpired() || (($limit=$this->getTestLimit()) > 0 && $number > $limit))
336 336
 		{
337 337
 			$this->regenerateToken();
338 338
 			return false;
339 339
 		}
340
-		return ($this->getToken()===($this->getCaseSensitive()?$input:strtoupper($input)));
340
+		return ($this->getToken()===($this->getCaseSensitive() ? $input : strtoupper($input)));
341 341
 	}
342 342
 
343 343
 	/**
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		$this->setPublicKey('');
352 352
 		$this->clearViewState('TokenGenerated');
353 353
 		$this->clearViewState('RandomSeed');
354
-		$this->clearViewState('TestNumber',0);
354
+		$this->clearViewState('TestNumber', 0);
355 355
 	}
356 356
 
357 357
 	/**
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		parent::onPreRender($param);
364 364
 		if(!self::checkRequirements())
365 365
 			throw new TConfigurationException('captcha_imagettftext_required');
366
-		if(!$this->getViewState('TokenGenerated',0))
366
+		if(!$this->getViewState('TokenGenerated', 0))
367 367
 		{
368 368
 			$manager=$this->getApplication()->getAssetManager();
369 369
 			$manager->publishFilePath($this->getFontFile());
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 			$url.='?options='.urlencode($this->getTokenImageOptions());
372 372
 			$this->setImageUrl($url);
373 373
 
374
-			$this->setViewState('TokenGenerated',time());
374
+			$this->setViewState('TokenGenerated', time());
375 375
 		}
376 376
 	}
377 377
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 */
381 381
 	protected function getTokenImageOptions()
382 382
 	{
383
-		$privateKey=$this->getPrivateKey();  // call this method to ensure private key is generated
383
+		$privateKey=$this->getPrivateKey(); // call this method to ensure private key is generated
384 384
 		$token=$this->getToken();
385 385
 		$options=array();
386 386
 		$options['publicKey']=$this->getPublicKey();
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 		$options['alphabet']=$this->getTokenAlphabet();
390 390
 		$options['fontSize']=$this->getTokenFontSize();
391 391
 		$options['theme']=$this->getTokenImageTheme();
392
-		if(($randomSeed=$this->getViewState('RandomSeed',0))===0)
392
+		if(($randomSeed=$this->getViewState('RandomSeed', 0))===0)
393 393
 		{
394
-			$randomSeed=(int)(microtime()*1000000);
395
-			$this->setViewState('RandomSeed',$randomSeed);
394
+			$randomSeed=(int) (microtime() * 1000000);
395
+			$this->setViewState('RandomSeed', $randomSeed);
396 396
 		}
397
-		$options['randomSeed']=$this->getChangingTokenBackground()?0:$randomSeed;
397
+		$options['randomSeed']=$this->getChangingTokenBackground() ? 0 : $randomSeed;
398 398
 		$str=serialize($options);
399 399
 		return base64_encode(md5($privateKey.$str).$str);
400 400
 	}
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 			$content="<?php
429 429
 \$privateKey='$key';
430 430
 ?>";
431
-			file_put_contents($fileName,$content);
431
+			file_put_contents($fileName, $content);
432 432
 		}
433 433
 		return $fileName;
434 434
 	}
@@ -449,10 +449,10 @@  discard block
 block discarded – undo
449 449
 	 * @param boolean whether the token is case sensitive
450 450
 	 * @return string the token generated.
451 451
 	 */
452
-	protected function generateToken($publicKey,$privateKey,$alphabet,$tokenLength,$caseSensitive)
452
+	protected function generateToken($publicKey, $privateKey, $alphabet, $tokenLength, $caseSensitive)
453 453
 	{
454
-		$token=substr($this->hash2string(md5($publicKey.$privateKey),$alphabet).$this->hash2string(md5($privateKey.$publicKey),$alphabet),0,$tokenLength);
455
-		return $caseSensitive?$token:strtoupper($token);
454
+		$token=substr($this->hash2string(md5($publicKey.$privateKey), $alphabet).$this->hash2string(md5($privateKey.$publicKey), $alphabet), 0, $tokenLength);
455
+		return $caseSensitive ? $token : strtoupper($token);
456 456
 	}
457 457
 
458 458
 	/**
@@ -461,20 +461,20 @@  discard block
 block discarded – undo
461 461
 	 * @param string the alphabet used to represent the converted string. If empty, it means '234578adefhijmnrtwyABDEFGHIJLMNQRTWY', which excludes those confusing characters.
462 462
 	 * @return string the converted string
463 463
 	 */
464
-	protected function hash2string($hex,$alphabet='')
464
+	protected function hash2string($hex, $alphabet='')
465 465
 	{
466
-		if(strlen($alphabet)<2)
466
+		if(strlen($alphabet) < 2)
467 467
 			$alphabet='234578adefhijmnrtABDEFGHJLMNQRT';
468 468
 		$hexLength=strlen($hex);
469 469
 		$base=strlen($alphabet);
470 470
 		$result='';
471
-		for($i=0;$i<$hexLength;$i+=6)
471
+		for($i=0; $i < $hexLength; $i+=6)
472 472
 		{
473
-			$number=hexdec(substr($hex,$i,6));
473
+			$number=hexdec(substr($hex, $i, 6));
474 474
 			while($number)
475 475
 			{
476
-				$result.=$alphabet[$number%$base];
477
-				$number=floor($number/$base);
476
+				$result.=$alphabet[$number % $base];
477
+				$number=floor($number / $base);
478 478
 			}
479 479
 		}
480 480
 		return $result;
Please login to merge, or discard this patch.