Completed
Push — intl ( 51e284 )
by Fabio
06:51
created
framework/TService.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -49,6 +49,7 @@
 block discarded – undo
49 49
 
50 50
 	/**
51 51
 	 * @param string id of this service
52
+	 * @param string $value
52 53
 	 */
53 54
 	public function setID($value)
54 55
 	{
Please login to merge, or discard this patch.
framework/Util/TLogger.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -98,6 +98,7 @@
 block discarded – undo
98 98
 	 * @param integer level filter
99 99
 	 * @param array category filter
100 100
 	 * @param array control filter
101
+	 * @param integer $levels
101 102
 	 * @return array list of messages. Each array elements represents one message
102 103
 	 * with the following structure:
103 104
 	 * array(
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -63,16 +63,16 @@  discard block
 block discarded – undo
63 63
 	 * @param string category of the message
64 64
 	 * @param string|TControl control of the message
65 65
 	 */
66
-	public function log($message,$level,$category='Uncategorized', $ctl=null)
66
+	public function log($message, $level, $category='Uncategorized', $ctl=null)
67 67
 	{
68 68
 		if($ctl) {
69 69
 			if($ctl instanceof TControl)
70
-				$ctl = $ctl->ClientId;
70
+				$ctl=$ctl->ClientId;
71 71
 			else if(!is_string($ctl))
72
-				$ctl = null;
72
+				$ctl=null;
73 73
 		} else
74
-			$ctl = null;
75
-		$this->_logs[]=array($message,$level,$category,microtime(true),memory_get_usage(),$ctl);
74
+			$ctl=null;
75
+		$this->_logs[]=array($message, $level, $category, microtime(true), memory_get_usage(), $ctl);
76 76
 	}
77 77
 
78 78
 	/**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 *   [4] => memory in bytes
109 109
 	 *   [5] => control client id
110 110
 	 */
111
-	public function getLogs($levels=null,$categories=null,$controls=null,$timestamp=null)
111
+	public function getLogs($levels=null, $categories=null, $controls=null, $timestamp=null)
112 112
 	{
113 113
 		$this->_levels=$levels;
114 114
 		$this->_categories=$categories;
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 		$this->_timestamp=$timestamp;
117 117
 		if(empty($levels) && empty($categories) && empty($controls) && is_null($timestamp))
118 118
 			return $this->_logs;
119
-		$logs = $this->_logs;
119
+		$logs=$this->_logs;
120 120
 		if(!empty($levels))
121
-			$logs = array_values(array_filter( array_filter($logs,array($this,'filterByLevels')) ));
121
+			$logs=array_values(array_filter(array_filter($logs, array($this, 'filterByLevels'))));
122 122
 		if(!empty($categories))
123
-			$logs = array_values(array_filter( array_filter($logs,array($this,'filterByCategories')) ));
123
+			$logs=array_values(array_filter(array_filter($logs, array($this, 'filterByCategories'))));
124 124
 		if(!empty($controls))
125
-			$logs = array_values(array_filter( array_filter($logs,array($this,'filterByControl')) ));
125
+			$logs=array_values(array_filter(array_filter($logs, array($this, 'filterByControl'))));
126 126
 		if(!is_null($timestamp))
127
-			$logs = array_values(array_filter( array_filter($logs,array($this,'filterByTimeStamp')) ));
127
+			$logs=array_values(array_filter(array_filter($logs, array($this, 'filterByTimeStamp'))));
128 128
 		return $logs;
129 129
 	}
130 130
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * @param array category filter
153 153
 	 * @param array control filter
154 154
 	 */
155
-	public function deleteLogs($levels=null,$categories=null,$controls=null,$timestamp=null)
155
+	public function deleteLogs($levels=null, $categories=null, $controls=null, $timestamp=null)
156 156
 	{
157 157
 		$this->_levels=$levels;
158 158
 		$this->_categories=$categories;
@@ -163,16 +163,16 @@  discard block
 block discarded – undo
163 163
 			$this->_logs=array();
164 164
 			return;
165 165
 		}
166
-		$logs = $this->_logs;
166
+		$logs=$this->_logs;
167 167
 		if(!empty($levels))
168
-			$logs = array_filter( array_filter($logs,array($this,'filterByLevels')) );
168
+			$logs=array_filter(array_filter($logs, array($this, 'filterByLevels')));
169 169
 		if(!empty($categories))
170
-			$logs = array_filter( array_filter($logs,array($this,'filterByCategories')) );
170
+			$logs=array_filter(array_filter($logs, array($this, 'filterByCategories')));
171 171
 		if(!empty($controls))
172
-			$logs = array_filter( array_filter($logs,array($this,'filterByControl')) );
172
+			$logs=array_filter(array_filter($logs, array($this, 'filterByControl')));
173 173
 		if(!is_null($timestamp))
174
-			$logs = array_filter( array_filter($logs,array($this,'filterByTimeStamp')) );
175
-		$this->_logs = array_values( array_diff_key($this->_logs, $logs) );
174
+			$logs=array_filter(array_filter($logs, array($this, 'filterByTimeStamp')));
175
+		$this->_logs=array_values(array_diff_key($this->_logs, $logs));
176 176
 	}
177 177
 
178 178
 	/**
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 		foreach($this->_categories as $category)
185 185
 		{
186 186
 			// element 2 is the category
187
-			if($value[2]===$category || strpos($value[2],$category.'.')===0)
187
+			if($value[2]===$category || strpos($value[2], $category.'.')===0)
188 188
 				return $value;
189 189
 		}
190 190
 		return false;
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		// element 5 are the control client ids
213 213
 		foreach($this->_controls as $control)
214 214
 		{
215
-			if($value[5]===$control || strpos($value[5],$control)===0)
215
+			if($value[5]===$control || strpos($value[5], $control)===0)
216 216
 				return $value;
217 217
 		}
218 218
 		return false;
Please login to merge, or discard this patch.
framework/Util/TRpcClient.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -105,6 +105,9 @@
 block discarded – undo
105 105
 	 * @param string RPC server URL
106 106
 	 * @param array payload data
107 107
 	 * @param string request mime type
108
+	 * @param string $serverUrl
109
+	 * @param string $mimeType
110
+	 * @return string
108 111
 	 */
109 112
 	protected function performRequest($serverUrl, $payload, $mimeType)
110 113
 	{
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	 * @var boolean whether the request is a notification and therefore should not care about the result (default: false)
59 59
 	 */
60
-	private $_isNotification = false;
60
+	private $_isNotification=false;
61 61
 
62 62
 	// magics
63 63
 
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	 * @param string url to RPC server
66 66
 	 * @param boolean whether requests are considered to be notifications (completely ignoring the response) (default: false)
67 67
 	 */
68
-	public function __construct($serverUrl, $isNotification = false)
68
+	public function __construct($serverUrl, $isNotification=false)
69 69
 	{
70
-		$this->_serverUrl = $serverUrl;
71
-		$this->_isNotification = TPropertyValue::ensureBoolean($isNotification);
70
+		$this->_serverUrl=$serverUrl;
71
+		$this->_isNotification=TPropertyValue::ensureBoolean($isNotification);
72 72
 	}
73 73
 
74 74
 	// methods
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	 * @return TRpcClient instance
79 79
 	 * @throws TApplicationException if an unsupported RPC client type was specified
80 80
 	 */
81
-	public static function create($type, $serverUrl, $isNotification = false)
81
+	public static function create($type, $serverUrl, $isNotification=false)
82 82
 	{
83
-		if(($_handler = constant('TRpcClientTypesEnumerable::'.strtoupper($type))) === null)
83
+		if(($_handler=constant('TRpcClientTypesEnumerable::'.strtoupper($type)))===null)
84 84
 			throw new TApplicationException('rpcclient_unsupported_handler');
85 85
 
86 86
 		return new $_handler($serverUrl, $isNotification);
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	protected function performRequest($serverUrl, $payload, $mimeType)
112 112
 	{
113
-		if(($_response = @file_get_contents($serverUrl, false, $this->createStreamContext($payload, $mimeType))) === false)
113
+		if(($_response=@file_get_contents($serverUrl, false, $this->createStreamContext($payload, $mimeType)))===false)
114 114
 			throw new TRpcClientRequestException('Request failed ("'.$http_response_header[0].'")');
115 115
 
116 116
 		return $_response;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 */
132 132
 	public function setIsNotification($bool)
133 133
 	{
134
-		$this->_isNotification = TPropertyValue::ensureBoolean($bool);
134
+		$this->_isNotification=TPropertyValue::ensureBoolean($bool);
135 135
 	}
136 136
 
137 137
 	/**
@@ -147,6 +147,6 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	public function setServerUrl($value)
149 149
 	{
150
-		$this->_serverUrl = $value;
150
+		$this->_serverUrl=$value;
151 151
 	}
152 152
 }
153 153
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Util/TSimpleDateFormatter.php 3 patches
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -60,6 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * Constructor, create a new date time formatter.
61 61
 	 * @param string formatting pattern.
62 62
 	 * @param string pattern and value charset
63
+	 * @param string $pattern
63 64
 	 */
64 65
 	public function __construct($pattern, $charset='UTF-8')
65 66
 	{
@@ -93,6 +94,7 @@  discard block
 block discarded – undo
93 94
 
94 95
 	/**
95 96
 	 * @param string formatting charset.
97
+	 * @param string $charset
96 98
 	 */
97 99
 	public function setCharset($charset)
98 100
 	{
@@ -313,6 +315,7 @@  discard block
 block discarded – undo
313 315
 
314 316
 	/**
315 317
 	 * Calculate the length of a string, may be consider iconv_strlen?
318
+	 * @param string $string
316 319
 	 */
317 320
 	private function length($string)
318 321
 	{
@@ -338,6 +341,9 @@  discard block
 block discarded – undo
338 341
 
339 342
 	/**
340 343
 	 * Returns true if char at position equals a particular char.
344
+	 * @param string $string
345
+	 * @param integer $pos
346
+	 * @param string $char
341 347
 	 */
342 348
 	private function charEqual($string, $pos, $char)
343 349
 	{
@@ -350,6 +356,10 @@  discard block
 block discarded – undo
350 356
 	 * @param int starting position
351 357
 	 * @param int minimum integer length
352 358
 	 * @param int maximum integer length
359
+	 * @param string $str
360
+	 * @param integer $i
361
+	 * @param integer|null $minlength
362
+	 * @param integer|null $maxlength
353 363
 	 * @return string integer portion of the string, null otherwise
354 364
 	 */
355 365
 	private function getInteger($str,$i,$minlength,$maxlength)
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -225,8 +225,7 @@  discard block
 block discarded – undo
225 225
 			$year = "{$date['year']}";
226 226
 			$month = $date['mon'];
227 227
 			$day = $date['mday'];
228
-		}
229
-		else
228
+		} else
230 229
 		{
231 230
 			$year = null;
232 231
 			$month = null;
@@ -262,8 +261,7 @@  discard block
 block discarded – undo
262 261
 						$year = $iYear + 2000;
263 262
 				}
264 263
 				$year = (int)$year;
265
-			}
266
-			elseif($token=='MM' || $token=='M')
264
+			} elseif($token=='MM' || $token=='M')
267 265
 			{
268 266
 				$month=$this->getInteger($value,$i_val,
269 267
 									$this->length($token),2);
@@ -273,8 +271,7 @@  discard block
 block discarded – undo
273 271
 					//throw new TInvalidDataValueException('Invalid month', $value);
274 272
 				$i_val += strlen($month);
275 273
 				$month = $iMonth;
276
-			}
277
-			elseif ($token=='dd' || $token=='d')
274
+			} elseif ($token=='dd' || $token=='d')
278 275
 			{
279 276
 				$day = $this->getInteger($value,$i_val,
280 277
 									$this->length($token), 2);
@@ -284,8 +281,7 @@  discard block
 block discarded – undo
284 281
 					//throw new TInvalidDataValueException('Invalid day', $value);
285 282
 				$i_val += strlen($day);
286 283
 				$day = $iDay;
287
-			}
288
-			else
284
+			} else
289 285
 			{
290 286
 				if($this->substring($value, $i_val, $this->length($token)) != $token)
291 287
 					return null;
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * Charset, default is 'UTF-8'
61 61
 	 * @var string
62 62
 	 */
63
-	private $charset = 'UTF-8';
63
+	private $charset='UTF-8';
64 64
 
65 65
 	/**
66 66
 	 * Constructor, create a new date time formatter.
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function setPattern($pattern)
88 88
 	{
89
-		$this->pattern = $pattern;
89
+		$this->pattern=$pattern;
90 90
 	}
91 91
 
92 92
 	/**
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function setCharset($charset)
104 104
 	{
105
-		$this->charset = $charset;
105
+		$this->charset=$charset;
106 106
 	}
107 107
 
108 108
 	/**
@@ -112,17 +112,17 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function format($value)
114 114
 	{
115
-		$date = $this->getDate($value);
116
-		$bits['yyyy'] = $date['year'];
117
-		$bits['yy'] = substr("{$date['year']}", -2);
115
+		$date=$this->getDate($value);
116
+		$bits['yyyy']=$date['year'];
117
+		$bits['yy']=substr("{$date['year']}", -2);
118 118
 
119
-		$bits['MM'] = str_pad("{$date['mon']}", 2, '0', STR_PAD_LEFT);
120
-		$bits['M'] = $date['mon'];
119
+		$bits['MM']=str_pad("{$date['mon']}", 2, '0', STR_PAD_LEFT);
120
+		$bits['M']=$date['mon'];
121 121
 
122
-		$bits['dd'] = str_pad("{$date['mday']}", 2, '0', STR_PAD_LEFT);
123
-		$bits['d'] = $date['mday'];
122
+		$bits['dd']=str_pad("{$date['mday']}", 2, '0', STR_PAD_LEFT);
123
+		$bits['d']=$date['mday'];
124 124
 
125
-		$pattern = preg_replace('/M{3,4}/', 'MM', $this->pattern);
125
+		$pattern=preg_replace('/M{3,4}/', 'MM', $this->pattern);
126 126
 		return str_replace(array_keys($bits), $bits, $pattern);
127 127
 	}
128 128
 
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
 
160 160
 	public function getDayMonthYearOrdering()
161 161
 	{
162
-		$ordering = array();
163
-		if(is_int($day= strpos($this->pattern, 'd')))
164
-			$ordering['day'] = $day;
165
-		if(is_int($month= strpos($this->pattern, 'M')))
166
-			$ordering['month'] = $month;
167
-		if(is_int($year= strpos($this->pattern, 'yy')))
168
-			$ordering['year'] = $year;
162
+		$ordering=array();
163
+		if(is_int($day=strpos($this->pattern, 'd')))
164
+			$ordering['day']=$day;
165
+		if(is_int($month=strpos($this->pattern, 'M')))
166
+			$ordering['month']=$month;
167
+		if(is_int($year=strpos($this->pattern, 'yy')))
168
+			$ordering['year']=$year;
169 169
 		asort($ordering);
170 170
 		return array_keys($ordering);
171 171
 	}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	private function getDate($value)
179 179
 	{
180
-		$s = new TDateTimeStamp;
180
+		$s=new TDateTimeStamp;
181 181
 		if(is_numeric($value))
182 182
 			return $s->getDate($value);
183 183
 		else
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function isValidDate($value)
191 191
 	{
192
-		if($value === null) {
192
+		if($value===null) {
193 193
 			return false;
194 194
 		} else {
195
-			return $this->parse($value, false) !== null;
195
+			return $this->parse($value, false)!==null;
196 196
 		}
197 197
 	}
198 198
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * @return int date time stamp
203 203
 	 * @throws TInvalidDataValueException if date string is malformed.
204 204
 	 */
205
-	public function parse($value,$defaultToCurrentTime=true)
205
+	public function parse($value, $defaultToCurrentTime=true)
206 206
 	{
207 207
 		if(is_int($value) || is_float($value))
208 208
 			return $value;
@@ -211,108 +211,108 @@  discard block
 block discarded – undo
211 211
 
212 212
 		if(empty($this->pattern)) return time();
213 213
 
214
-		$date = time();
214
+		$date=time();
215 215
 
216 216
 		if($this->length(trim($value)) < 1)
217 217
 			return $defaultToCurrentTime ? $date : null;
218 218
 
219
-		$pattern = $this->pattern;
219
+		$pattern=$this->pattern;
220 220
 
221
-		$i_val = 0;
222
-		$i_format = 0;
223
-		$pattern_length = $this->length($pattern);
224
-		$c = '';
221
+		$i_val=0;
222
+		$i_format=0;
223
+		$pattern_length=$this->length($pattern);
224
+		$c='';
225 225
 		$token='';
226 226
 		$x=null; $y=null;
227 227
 
228 228
 
229 229
 		if($defaultToCurrentTime)
230 230
 		{
231
-			$year = "{$date['year']}";
232
-			$month = $date['mon'];
233
-			$day = $date['mday'];
231
+			$year="{$date['year']}";
232
+			$month=$date['mon'];
233
+			$day=$date['mday'];
234 234
 		}
235 235
 		else
236 236
 		{
237
-			$year = null;
238
-			$month = null;
239
-			$day = null;
237
+			$year=null;
238
+			$month=null;
239
+			$day=null;
240 240
 		}
241 241
 
242
-		while ($i_format < $pattern_length)
242
+		while($i_format < $pattern_length)
243 243
 		{
244
-			$c = $this->charAt($pattern,$i_format);
244
+			$c=$this->charAt($pattern, $i_format);
245 245
 			$token='';
246
-			while ($this->charEqual($pattern, $i_format, $c)
246
+			while($this->charEqual($pattern, $i_format, $c)
247 247
 						&& ($i_format < $pattern_length))
248 248
 			{
249
-				$token .= $this->charAt($pattern, $i_format++);
249
+				$token.=$this->charAt($pattern, $i_format++);
250 250
 			}
251 251
 
252
-			if ($token=='yyyy' || $token=='yy' || $token=='y')
252
+			if($token=='yyyy' || $token=='yy' || $token=='y')
253 253
 			{
254
-				if ($token=='yyyy') { $x=4;$y=4; }
255
-				if ($token=='yy')   { $x=2;$y=2; }
256
-				if ($token=='y')    { $x=2;$y=4; }
257
-				$year = $this->getInteger($value,$i_val,$x,$y);
258
-				if($year === null)
254
+				if($token=='yyyy') { $x=4; $y=4; }
255
+				if($token=='yy') { $x=2; $y=2; }
256
+				if($token=='y') { $x=2; $y=4; }
257
+				$year=$this->getInteger($value, $i_val, $x, $y);
258
+				if($year===null)
259 259
 					return null;
260 260
 					//throw new TInvalidDataValueException('Invalid year', $value);
261
-				$i_val += strlen($year);
262
-				if(strlen($year) == 2)
261
+				$i_val+=strlen($year);
262
+				if(strlen($year)==2)
263 263
 				{
264
-					$iYear = (int)$year;
264
+					$iYear=(int) $year;
265 265
 					if($iYear > 70)
266
-						$year = $iYear + 1900;
266
+						$year=$iYear + 1900;
267 267
 					else
268
-						$year = $iYear + 2000;
268
+						$year=$iYear + 2000;
269 269
 				}
270
-				$year = (int)$year;
270
+				$year=(int) $year;
271 271
 			}
272 272
 			elseif($token=='MM' || $token=='M')
273 273
 			{
274
-				$month=$this->getInteger($value,$i_val,
275
-									$this->length($token),2);
276
-				$iMonth = (int)$month;
277
-				if($month === null || $iMonth < 1 || $iMonth > 12 )
274
+				$month=$this->getInteger($value, $i_val,
275
+									$this->length($token), 2);
276
+				$iMonth=(int) $month;
277
+				if($month===null || $iMonth < 1 || $iMonth > 12)
278 278
 					return null;
279 279
 					//throw new TInvalidDataValueException('Invalid month', $value);
280
-				$i_val += strlen($month);
281
-				$month = $iMonth;
280
+				$i_val+=strlen($month);
281
+				$month=$iMonth;
282 282
 			}
283
-			elseif ($token=='dd' || $token=='d')
283
+			elseif($token=='dd' || $token=='d')
284 284
 			{
285
-				$day = $this->getInteger($value,$i_val,
285
+				$day=$this->getInteger($value, $i_val,
286 286
 									$this->length($token), 2);
287
-				$iDay = (int)$day;
288
-				if($day === null || $iDay < 1 || $iDay >31)
287
+				$iDay=(int) $day;
288
+				if($day===null || $iDay < 1 || $iDay > 31)
289 289
 					return null;
290 290
 					//throw new TInvalidDataValueException('Invalid day', $value);
291
-				$i_val += strlen($day);
292
-				$day = $iDay;
291
+				$i_val+=strlen($day);
292
+				$day=$iDay;
293 293
 			}
294 294
 			else
295 295
 			{
296
-				if($this->substring($value, $i_val, $this->length($token)) != $token)
296
+				if($this->substring($value, $i_val, $this->length($token))!=$token)
297 297
 					return null;
298 298
 					//throw new TInvalidDataValueException("Subpattern '{$this->pattern}' mismatch", $value);
299 299
 				else
300
-					$i_val += $this->length($token);
300
+					$i_val+=$this->length($token);
301 301
 			}
302 302
 		}
303
-		if ($i_val != $this->length($value))
303
+		if($i_val!=$this->length($value))
304 304
 			return null;
305 305
 			//throw new TInvalidDataValueException("Pattern '{$this->pattern}' mismatch", $value);
306
-		if(!$defaultToCurrentTime && ($month === null || $day === null || $year === null))
306
+		if(!$defaultToCurrentTime && ($month===null || $day===null || $year===null))
307 307
 			return null;
308 308
 		else
309 309
 		{
310 310
 			if(empty($year)) {
311
-				$year = date('Y');
311
+				$year=date('Y');
312 312
 			}
313
-			$day = (int)$day <= 0 ? 1 : (int)$day;
314
-			$month = (int)$month <= 0 ? 1 : (int)$month;
315
-			$s = new TDateTimeStamp;
313
+			$day=(int) $day <= 0 ? 1 : (int) $day;
314
+			$month=(int) $month <= 0 ? 1 : (int) $month;
315
+			$s=new TDateTimeStamp;
316 316
 			return $s->getTimeStamp(0, 0, 0, $month, $day, $year);
317 317
 		}
318 318
 	}
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 */
348 348
 	private function charEqual($string, $pos, $char)
349 349
 	{
350
-		return $this->charAt($string, $pos) == $char;
350
+		return $this->charAt($string, $pos)==$char;
351 351
 	}
352 352
 
353 353
 	/**
@@ -358,15 +358,15 @@  discard block
 block discarded – undo
358 358
 	 * @param int maximum integer length
359 359
 	 * @return string integer portion of the string, null otherwise
360 360
 	 */
361
-	private function getInteger($str,$i,$minlength,$maxlength)
361
+	private function getInteger($str, $i, $minlength, $maxlength)
362 362
 	{
363 363
 		//match for digits backwards
364
-		for ($x = $maxlength; $x >= $minlength; $x--)
364
+		for($x=$maxlength; $x >= $minlength; $x--)
365 365
 		{
366
-			$token= $this->substring($str, $i,$x);
367
-			if ($this->length($token) < $minlength)
366
+			$token=$this->substring($str, $i, $x);
367
+			if($this->length($token) < $minlength)
368 368
 				return null;
369
-			if (preg_match('/^\d+$/', $token))
369
+			if(preg_match('/^\d+$/', $token))
370 370
 				return $token;
371 371
 		}
372 372
 		return null;
Please login to merge, or discard this patch.
framework/Util/TVarDumper.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -55,6 +55,9 @@
 block discarded – undo
55 55
 			return self::$_output;
56 56
 	}
57 57
 
58
+	/**
59
+	 * @param integer $level
60
+	 */
58 61
 	private static function dumpInternal($var,$level)
59 62
 	{
60 63
 		switch(gettype($var))
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,27 +40,27 @@  discard block
 block discarded – undo
40 40
 	 * @param integer maximum depth that the dumper should go into the variable. Defaults to 10.
41 41
 	 * @return string the string representation of the variable
42 42
 	 */
43
-	public static function dump($var,$depth=10,$highlight=false)
43
+	public static function dump($var, $depth=10, $highlight=false)
44 44
 	{
45 45
 		self::$_output='';
46 46
 		self::$_objects=array();
47 47
 		self::$_depth=$depth;
48
-		self::dumpInternal($var,0);
48
+		self::dumpInternal($var, 0);
49 49
 		if($highlight)
50 50
 		{
51
-			$result=highlight_string("<?php\n".self::$_output,true);
52
-			return preg_replace('/&lt;\\?php<br \\/>/','',$result,1);
51
+			$result=highlight_string("<?php\n".self::$_output, true);
52
+			return preg_replace('/&lt;\\?php<br \\/>/', '', $result, 1);
53 53
 		}
54 54
 		else
55 55
 			return self::$_output;
56 56
 	}
57 57
 
58
-	private static function dumpInternal($var,$level)
58
+	private static function dumpInternal($var, $level)
59 59
 	{
60 60
 		switch(gettype($var))
61 61
 		{
62 62
 			case 'boolean':
63
-				self::$_output.=$var?'true':'false';
63
+				self::$_output.=$var ? 'true' : 'false';
64 64
 				break;
65 65
 			case 'integer':
66 66
 				self::$_output.="$var";
@@ -81,41 +81,41 @@  discard block
 block discarded – undo
81 81
 				self::$_output.='{unknown}';
82 82
 				break;
83 83
 			case 'array':
84
-				if(self::$_depth<=$level)
84
+				if(self::$_depth <= $level)
85 85
 					self::$_output.='array(...)';
86 86
 				else if(empty($var))
87 87
 					self::$_output.='array()';
88 88
 				else
89 89
 				{
90 90
 					$keys=array_keys($var);
91
-					$spaces=str_repeat(' ',$level*4);
91
+					$spaces=str_repeat(' ', $level * 4);
92 92
 					self::$_output.="array\n".$spaces.'(';
93 93
 					foreach($keys as $key)
94 94
 					{
95 95
 						self::$_output.="\n".$spaces."    [$key] => ";
96
-						self::$_output.=self::dumpInternal($var[$key],$level+1);
96
+						self::$_output.=self::dumpInternal($var[$key], $level + 1);
97 97
 					}
98 98
 					self::$_output.="\n".$spaces.')';
99 99
 				}
100 100
 				break;
101 101
 			case 'object':
102
-				if(($id=array_search($var,self::$_objects,true))!==false)
103
-					self::$_output.=get_class($var).'#'.($id+1).'(...)';
104
-				else if(self::$_depth<=$level)
102
+				if(($id=array_search($var, self::$_objects, true))!==false)
103
+					self::$_output.=get_class($var).'#'.($id + 1).'(...)';
104
+				else if(self::$_depth <= $level)
105 105
 					self::$_output.=get_class($var).'(...)';
106 106
 				else
107 107
 				{
108
-					$id=array_push(self::$_objects,$var);
108
+					$id=array_push(self::$_objects, $var);
109 109
 					$className=get_class($var);
110
-					$members=(array)$var;
110
+					$members=(array) $var;
111 111
 					$keys=array_keys($members);
112
-					$spaces=str_repeat(' ',$level*4);
112
+					$spaces=str_repeat(' ', $level * 4);
113 113
 					self::$_output.="$className#$id\n".$spaces.'(';
114 114
 					foreach($keys as $key)
115 115
 					{
116
-						$keyDisplay=strtr(trim($key),array("\0"=>':'));
116
+						$keyDisplay=strtr(trim($key), array("\0"=>':'));
117 117
 						self::$_output.="\n".$spaces."    [$keyDisplay] => ";
118
-						self::$_output.=self::dumpInternal($members[$key],$level+1);
118
+						self::$_output.=self::dumpInternal($members[$key], $level + 1);
119 119
 					}
120 120
 					self::$_output.="\n".$spaces.')';
121 121
 				}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@
 block discarded – undo
52 52
 		{
53 53
 			$result=highlight_string("<?php\n".self::$_output,true);
54 54
 			return preg_replace('/&lt;\\?php<br \\/>/','',$result,1);
55
-		}
56
-		else
55
+		} else
57 56
 			return self::$_output;
58 57
 	}
59 58
 
Please login to merge, or discard this patch.
framework/Web/Javascripts/JSMin.php 4 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -73,6 +73,9 @@  discard block
 block discarded – undo
73 73
 
74 74
   // -- Protected Instance Methods ---------------------------------------------
75 75
 
76
+  /**
77
+   * @param integer $d
78
+   */
76 79
   protected function action($d) {
77 80
     switch($d) {
78 81
       case 1:
@@ -132,6 +135,9 @@  discard block
 block discarded – undo
132 135
     }
133 136
   }
134 137
 
138
+  /**
139
+   * @return string
140
+   */
135 141
   protected function get() {
136 142
     $c = $this->lookAhead;
137 143
     $this->lookAhead = null;
@@ -156,6 +162,9 @@  discard block
 block discarded – undo
156 162
     return ' ';
157 163
   }
158 164
 
165
+  /**
166
+   * @param string $c
167
+   */
159 168
   protected function isAlphaNum($c) {
160 169
     return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
161 170
   }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -191,8 +191,7 @@  discard block
 block discarded – undo
191 191
             default:
192 192
               if ($this->isAlphaNum($this->b)) {
193 193
                 $this->action(1);
194
-              }
195
-              else {
194
+              } else {
196 195
                 $this->action(2);
197 196
               }
198 197
           }
@@ -224,8 +223,7 @@  discard block
 block discarded – undo
224 223
                 default:
225 224
                   if ($this->isAlphaNum($this->a)) {
226 225
                     $this->action(1);
227
-                  }
228
-                  else {
226
+                  } else {
229 227
                     $this->action(3);
230 228
                   }
231 229
               }
Please login to merge, or discard this patch.
Indentation   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -59,228 +59,228 @@
 block discarded – undo
59 59
   // -- Public Static Methods --------------------------------------------------
60 60
 
61 61
   public static function minify($js) {
62
-    $jsmin = new JSMin($js);
63
-    return $jsmin->min();
62
+	$jsmin = new JSMin($js);
63
+	return $jsmin->min();
64 64
   }
65 65
 
66 66
   // -- Public Instance Methods ------------------------------------------------
67 67
 
68 68
   public function __construct($input) {
69
-    $this->input       = str_replace("\r\n", "\n", $input);
70
-    $this->inputLength = strlen($this->input);
69
+	$this->input       = str_replace("\r\n", "\n", $input);
70
+	$this->inputLength = strlen($this->input);
71 71
   }
72 72
 
73 73
   // -- Protected Instance Methods ---------------------------------------------
74 74
 
75 75
   protected function action($d) {
76
-    switch($d) {
77
-      case 1:
78
-        $this->output .= $this->a;
79
-
80
-      case 2:
81
-        $this->a = $this->b;
82
-
83
-        if ($this->a === "'" || $this->a === '"') {
84
-          for (;;) {
85
-            $this->output .= $this->a;
86
-            $this->a       = $this->get();
87
-
88
-            if ($this->a === $this->b) {
89
-              break;
90
-            }
91
-
92
-            if (ord($this->a) <= self::ORD_LF) {
93
-              throw new JSMinException('Unterminated string literal.');
94
-            }
95
-
96
-            if ($this->a === '\\') {
97
-              $this->output .= $this->a;
98
-              $this->a       = $this->get();
99
-            }
100
-          }
101
-        }
102
-
103
-      case 3:
104
-        $this->b = $this->next();
105
-
106
-        if ($this->b === '/' && (
107
-            $this->a === '(' || $this->a === ',' || $this->a === '=' ||
108
-            $this->a === ':' || $this->a === '[' || $this->a === '!' ||
109
-            $this->a === '&' || $this->a === '|' || $this->a === '?')) {
110
-
111
-          $this->output .= $this->a . $this->b;
112
-
113
-          for (;;) {
114
-            $this->a = $this->get();
115
-
116
-            if ($this->a === '/') {
117
-              break;
118
-            } elseif ($this->a === '\\') {
119
-              $this->output .= $this->a;
120
-              $this->a       = $this->get();
121
-            } elseif (ord($this->a) <= self::ORD_LF) {
122
-              throw new JSMinException('Unterminated regular expression '.
123
-                  'literal.');
124
-            }
125
-
126
-            $this->output .= $this->a;
127
-          }
128
-
129
-          $this->b = $this->next();
130
-        }
131
-    }
76
+	switch($d) {
77
+	  case 1:
78
+		$this->output .= $this->a;
79
+
80
+	  case 2:
81
+		$this->a = $this->b;
82
+
83
+		if ($this->a === "'" || $this->a === '"') {
84
+		  for (;;) {
85
+			$this->output .= $this->a;
86
+			$this->a       = $this->get();
87
+
88
+			if ($this->a === $this->b) {
89
+			  break;
90
+			}
91
+
92
+			if (ord($this->a) <= self::ORD_LF) {
93
+			  throw new JSMinException('Unterminated string literal.');
94
+			}
95
+
96
+			if ($this->a === '\\') {
97
+			  $this->output .= $this->a;
98
+			  $this->a       = $this->get();
99
+			}
100
+		  }
101
+		}
102
+
103
+	  case 3:
104
+		$this->b = $this->next();
105
+
106
+		if ($this->b === '/' && (
107
+			$this->a === '(' || $this->a === ',' || $this->a === '=' ||
108
+			$this->a === ':' || $this->a === '[' || $this->a === '!' ||
109
+			$this->a === '&' || $this->a === '|' || $this->a === '?')) {
110
+
111
+		  $this->output .= $this->a . $this->b;
112
+
113
+		  for (;;) {
114
+			$this->a = $this->get();
115
+
116
+			if ($this->a === '/') {
117
+			  break;
118
+			} elseif ($this->a === '\\') {
119
+			  $this->output .= $this->a;
120
+			  $this->a       = $this->get();
121
+			} elseif (ord($this->a) <= self::ORD_LF) {
122
+			  throw new JSMinException('Unterminated regular expression '.
123
+				  'literal.');
124
+			}
125
+
126
+			$this->output .= $this->a;
127
+		  }
128
+
129
+		  $this->b = $this->next();
130
+		}
131
+	}
132 132
   }
133 133
 
134 134
   protected function get() {
135
-    $c = $this->lookAhead;
136
-    $this->lookAhead = null;
137
-
138
-    if ($c === null) {
139
-      if ($this->inputIndex < $this->inputLength) {
140
-        $c = $this->input[$this->inputIndex];
141
-        $this->inputIndex += 1;
142
-      } else {
143
-        $c = null;
144
-      }
145
-    }
146
-
147
-    if ($c === "\r") {
148
-      return "\n";
149
-    }
150
-
151
-    if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) {
152
-      return $c;
153
-    }
154
-
155
-    return ' ';
135
+	$c = $this->lookAhead;
136
+	$this->lookAhead = null;
137
+
138
+	if ($c === null) {
139
+	  if ($this->inputIndex < $this->inputLength) {
140
+		$c = $this->input[$this->inputIndex];
141
+		$this->inputIndex += 1;
142
+	  } else {
143
+		$c = null;
144
+	  }
145
+	}
146
+
147
+	if ($c === "\r") {
148
+	  return "\n";
149
+	}
150
+
151
+	if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) {
152
+	  return $c;
153
+	}
154
+
155
+	return ' ';
156 156
   }
157 157
 
158 158
   protected function isAlphaNum($c) {
159
-    return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
159
+	return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
160 160
   }
161 161
 
162 162
   protected function min() {
163
-    $this->a = "\n";
164
-    $this->action(3);
165
-
166
-    while ($this->a !== null) {
167
-      switch ($this->a) {
168
-        case ' ':
169
-          if ($this->isAlphaNum($this->b)) {
170
-            $this->action(1);
171
-          } else {
172
-            $this->action(2);
173
-          }
174
-          break;
175
-
176
-        case "\n":
177
-          switch ($this->b) {
178
-            case '{':
179
-            case '[':
180
-            case '(':
181
-            case '+':
182
-            case '-':
183
-              $this->action(1);
184
-              break;
185
-
186
-            case ' ':
187
-              $this->action(3);
188
-              break;
189
-
190
-            default:
191
-              if ($this->isAlphaNum($this->b)) {
192
-                $this->action(1);
193
-              }
194
-              else {
195
-                $this->action(2);
196
-              }
197
-          }
198
-          break;
199
-
200
-        default:
201
-          switch ($this->b) {
202
-            case ' ':
203
-              if ($this->isAlphaNum($this->a)) {
204
-                $this->action(1);
205
-                break;
206
-              }
207
-
208
-              $this->action(3);
209
-              break;
210
-
211
-            case "\n":
212
-              switch ($this->a) {
213
-                case '}':
214
-                case ']':
215
-                case ')':
216
-                case '+':
217
-                case '-':
218
-                case '"':
219
-                case "'":
220
-                  $this->action(1);
221
-                  break;
222
-
223
-                default:
224
-                  if ($this->isAlphaNum($this->a)) {
225
-                    $this->action(1);
226
-                  }
227
-                  else {
228
-                    $this->action(3);
229
-                  }
230
-              }
231
-              break;
232
-
233
-            default:
234
-              $this->action(1);
235
-              break;
236
-          }
237
-      }
238
-    }
239
-
240
-    return $this->output;
163
+	$this->a = "\n";
164
+	$this->action(3);
165
+
166
+	while ($this->a !== null) {
167
+	  switch ($this->a) {
168
+		case ' ':
169
+		  if ($this->isAlphaNum($this->b)) {
170
+			$this->action(1);
171
+		  } else {
172
+			$this->action(2);
173
+		  }
174
+		  break;
175
+
176
+		case "\n":
177
+		  switch ($this->b) {
178
+			case '{':
179
+			case '[':
180
+			case '(':
181
+			case '+':
182
+			case '-':
183
+			  $this->action(1);
184
+			  break;
185
+
186
+			case ' ':
187
+			  $this->action(3);
188
+			  break;
189
+
190
+			default:
191
+			  if ($this->isAlphaNum($this->b)) {
192
+				$this->action(1);
193
+			  }
194
+			  else {
195
+				$this->action(2);
196
+			  }
197
+		  }
198
+		  break;
199
+
200
+		default:
201
+		  switch ($this->b) {
202
+			case ' ':
203
+			  if ($this->isAlphaNum($this->a)) {
204
+				$this->action(1);
205
+				break;
206
+			  }
207
+
208
+			  $this->action(3);
209
+			  break;
210
+
211
+			case "\n":
212
+			  switch ($this->a) {
213
+				case '}':
214
+				case ']':
215
+				case ')':
216
+				case '+':
217
+				case '-':
218
+				case '"':
219
+				case "'":
220
+				  $this->action(1);
221
+				  break;
222
+
223
+				default:
224
+				  if ($this->isAlphaNum($this->a)) {
225
+					$this->action(1);
226
+				  }
227
+				  else {
228
+					$this->action(3);
229
+				  }
230
+			  }
231
+			  break;
232
+
233
+			default:
234
+			  $this->action(1);
235
+			  break;
236
+		  }
237
+	  }
238
+	}
239
+
240
+	return $this->output;
241 241
   }
242 242
 
243 243
   protected function next() {
244
-    $c = $this->get();
245
-
246
-    if ($c === '/') {
247
-      switch($this->peek()) {
248
-        case '/':
249
-          for (;;) {
250
-            $c = $this->get();
251
-
252
-            if (ord($c) <= self::ORD_LF) {
253
-              return $c;
254
-            }
255
-          }
256
-
257
-        case '*':
258
-          $this->get();
259
-
260
-          for (;;) {
261
-            switch($this->get()) {
262
-              case '*':
263
-                if ($this->peek() === '/') {
264
-                  $this->get();
265
-                  return ' ';
266
-                }
267
-                break;
268
-
269
-              case null:
270
-                throw new JSMinException('Unterminated comment.');
271
-            }
272
-          }
273
-
274
-        default:
275
-          return $c;
276
-      }
277
-    }
278
-
279
-    return $c;
244
+	$c = $this->get();
245
+
246
+	if ($c === '/') {
247
+	  switch($this->peek()) {
248
+		case '/':
249
+		  for (;;) {
250
+			$c = $this->get();
251
+
252
+			if (ord($c) <= self::ORD_LF) {
253
+			  return $c;
254
+			}
255
+		  }
256
+
257
+		case '*':
258
+		  $this->get();
259
+
260
+		  for (;;) {
261
+			switch($this->get()) {
262
+			  case '*':
263
+				if ($this->peek() === '/') {
264
+				  $this->get();
265
+				  return ' ';
266
+				}
267
+				break;
268
+
269
+			  case null:
270
+				throw new JSMinException('Unterminated comment.');
271
+			}
272
+		  }
273
+
274
+		default:
275
+		  return $c;
276
+	  }
277
+	}
278
+
279
+	return $c;
280 280
   }
281 281
 
282 282
   protected function peek() {
283
-    $this->lookAhead = $this->get();
284
-    return $this->lookAhead;
283
+	$this->lookAhead = $this->get();
284
+	return $this->lookAhead;
285 285
   }
286 286
 }
287 287
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -47,29 +47,29 @@  discard block
 block discarded – undo
47 47
 namespace Prado\Web\Javascripts;
48 48
 
49 49
 class JSMin {
50
-  const ORD_LF    = 10;
51
-  const ORD_SPACE = 32;
50
+  const ORD_LF=10;
51
+  const ORD_SPACE=32;
52 52
 
53
-  protected $a           = '';
54
-  protected $b           = '';
55
-  protected $input       = '';
56
-  protected $inputIndex  = 0;
57
-  protected $inputLength = 0;
58
-  protected $lookAhead   = null;
59
-  protected $output      = '';
53
+  protected $a='';
54
+  protected $b='';
55
+  protected $input='';
56
+  protected $inputIndex=0;
57
+  protected $inputLength=0;
58
+  protected $lookAhead=null;
59
+  protected $output='';
60 60
 
61 61
   // -- Public Static Methods --------------------------------------------------
62 62
 
63 63
   public static function minify($js) {
64
-    $jsmin = new JSMin($js);
64
+    $jsmin=new JSMin($js);
65 65
     return $jsmin->min();
66 66
   }
67 67
 
68 68
   // -- Public Instance Methods ------------------------------------------------
69 69
 
70 70
   public function __construct($input) {
71
-    $this->input       = str_replace("\r\n", "\n", $input);
72
-    $this->inputLength = strlen($this->input);
71
+    $this->input=str_replace("\r\n", "\n", $input);
72
+    $this->inputLength=strlen($this->input);
73 73
   }
74 74
 
75 75
   // -- Protected Instance Methods ---------------------------------------------
@@ -77,80 +77,80 @@  discard block
 block discarded – undo
77 77
   protected function action($d) {
78 78
     switch($d) {
79 79
       case 1:
80
-        $this->output .= $this->a;
80
+        $this->output.=$this->a;
81 81
 
82 82
       case 2:
83
-        $this->a = $this->b;
83
+        $this->a=$this->b;
84 84
 
85
-        if ($this->a === "'" || $this->a === '"') {
86
-          for (;;) {
87
-            $this->output .= $this->a;
88
-            $this->a       = $this->get();
85
+        if($this->a==="'" || $this->a==='"') {
86
+          for(;;) {
87
+            $this->output.=$this->a;
88
+            $this->a=$this->get();
89 89
 
90
-            if ($this->a === $this->b) {
90
+            if($this->a===$this->b) {
91 91
               break;
92 92
             }
93 93
 
94
-            if (ord($this->a) <= self::ORD_LF) {
94
+            if(ord($this->a) <= self::ORD_LF) {
95 95
               throw new JSMinException('Unterminated string literal.');
96 96
             }
97 97
 
98
-            if ($this->a === '\\') {
99
-              $this->output .= $this->a;
100
-              $this->a       = $this->get();
98
+            if($this->a==='\\') {
99
+              $this->output.=$this->a;
100
+              $this->a=$this->get();
101 101
             }
102 102
           }
103 103
         }
104 104
 
105 105
       case 3:
106
-        $this->b = $this->next();
106
+        $this->b=$this->next();
107 107
 
108
-        if ($this->b === '/' && (
109
-            $this->a === '(' || $this->a === ',' || $this->a === '=' ||
110
-            $this->a === ':' || $this->a === '[' || $this->a === '!' ||
111
-            $this->a === '&' || $this->a === '|' || $this->a === '?')) {
108
+        if($this->b==='/' && (
109
+            $this->a==='(' || $this->a===',' || $this->a==='=' ||
110
+            $this->a===':' || $this->a==='[' || $this->a==='!' ||
111
+            $this->a==='&' || $this->a==='|' || $this->a==='?')) {
112 112
 
113
-          $this->output .= $this->a . $this->b;
113
+          $this->output.=$this->a.$this->b;
114 114
 
115
-          for (;;) {
116
-            $this->a = $this->get();
115
+          for(;;) {
116
+            $this->a=$this->get();
117 117
 
118
-            if ($this->a === '/') {
118
+            if($this->a==='/') {
119 119
               break;
120
-            } elseif ($this->a === '\\') {
121
-              $this->output .= $this->a;
122
-              $this->a       = $this->get();
123
-            } elseif (ord($this->a) <= self::ORD_LF) {
120
+            } elseif($this->a==='\\') {
121
+              $this->output.=$this->a;
122
+              $this->a=$this->get();
123
+            } elseif(ord($this->a) <= self::ORD_LF) {
124 124
               throw new JSMinException('Unterminated regular expression '.
125 125
                   'literal.');
126 126
             }
127 127
 
128
-            $this->output .= $this->a;
128
+            $this->output.=$this->a;
129 129
           }
130 130
 
131
-          $this->b = $this->next();
131
+          $this->b=$this->next();
132 132
         }
133 133
     }
134 134
   }
135 135
 
136 136
   protected function get() {
137
-    $c = $this->lookAhead;
138
-    $this->lookAhead = null;
137
+    $c=$this->lookAhead;
138
+    $this->lookAhead=null;
139 139
 
140
-    if ($c === null) {
141
-      if ($this->inputIndex < $this->inputLength) {
142
-        $c = $this->input[$this->inputIndex];
143
-        $this->inputIndex += 1;
140
+    if($c===null) {
141
+      if($this->inputIndex < $this->inputLength) {
142
+        $c=$this->input[$this->inputIndex];
143
+        $this->inputIndex+=1;
144 144
       } else {
145
-        $c = null;
145
+        $c=null;
146 146
       }
147 147
     }
148 148
 
149
-    if ($c === "\r") {
149
+    if($c==="\r") {
150 150
       return "\n";
151 151
     }
152 152
 
153
-    if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) {
153
+    if($c===null || $c==="\n" || ord($c) >= self::ORD_SPACE) {
154 154
       return $c;
155 155
     }
156 156
 
@@ -158,17 +158,17 @@  discard block
 block discarded – undo
158 158
   }
159 159
 
160 160
   protected function isAlphaNum($c) {
161
-    return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
161
+    return ord($c) > 126 || $c==='\\' || preg_match('/^[\w\$]$/', $c)===1;
162 162
   }
163 163
 
164 164
   protected function min() {
165
-    $this->a = "\n";
165
+    $this->a="\n";
166 166
     $this->action(3);
167 167
 
168
-    while ($this->a !== null) {
169
-      switch ($this->a) {
168
+    while($this->a!==null) {
169
+      switch($this->a) {
170 170
         case ' ':
171
-          if ($this->isAlphaNum($this->b)) {
171
+          if($this->isAlphaNum($this->b)) {
172 172
             $this->action(1);
173 173
           } else {
174 174
             $this->action(2);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
           break;
177 177
 
178 178
         case "\n":
179
-          switch ($this->b) {
179
+          switch($this->b) {
180 180
             case '{':
181 181
             case '[':
182 182
             case '(':
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
               break;
191 191
 
192 192
             default:
193
-              if ($this->isAlphaNum($this->b)) {
193
+              if($this->isAlphaNum($this->b)) {
194 194
                 $this->action(1);
195 195
               }
196 196
               else {
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
           break;
201 201
 
202 202
         default:
203
-          switch ($this->b) {
203
+          switch($this->b) {
204 204
             case ' ':
205
-              if ($this->isAlphaNum($this->a)) {
205
+              if($this->isAlphaNum($this->a)) {
206 206
                 $this->action(1);
207 207
                 break;
208 208
               }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
               break;
212 212
 
213 213
             case "\n":
214
-              switch ($this->a) {
214
+              switch($this->a) {
215 215
                 case '}':
216 216
                 case ']':
217 217
                 case ')':
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                   break;
224 224
 
225 225
                 default:
226
-                  if ($this->isAlphaNum($this->a)) {
226
+                  if($this->isAlphaNum($this->a)) {
227 227
                     $this->action(1);
228 228
                   }
229 229
                   else {
@@ -243,15 +243,15 @@  discard block
 block discarded – undo
243 243
   }
244 244
 
245 245
   protected function next() {
246
-    $c = $this->get();
246
+    $c=$this->get();
247 247
 
248
-    if ($c === '/') {
248
+    if($c==='/') {
249 249
       switch($this->peek()) {
250 250
         case '/':
251
-          for (;;) {
252
-            $c = $this->get();
251
+          for(;;) {
252
+            $c=$this->get();
253 253
 
254
-            if (ord($c) <= self::ORD_LF) {
254
+            if(ord($c) <= self::ORD_LF) {
255 255
               return $c;
256 256
             }
257 257
           }
@@ -259,10 +259,10 @@  discard block
 block discarded – undo
259 259
         case '*':
260 260
           $this->get();
261 261
 
262
-          for (;;) {
262
+          for(;;) {
263 263
             switch($this->get()) {
264 264
               case '*':
265
-                if ($this->peek() === '/') {
265
+                if($this->peek()==='/') {
266 266
                   $this->get();
267 267
                   return ' ';
268 268
                 }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
   }
283 283
 
284 284
   protected function peek() {
285
-    $this->lookAhead = $this->get();
285
+    $this->lookAhead=$this->get();
286 286
     return $this->lookAhead;
287 287
   }
288 288
 }
289 289
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/Services/TJsonService.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -140,6 +140,7 @@
 block discarded – undo
140 140
 	/**
141 141
 	 * Renders content provided by TJsonResponse::getJsonContent() as
142 142
 	 * javascript in JSON format.
143
+	 * @param TJsonResponse $service
143 144
 	 */
144 145
 	protected function createJsonResponse($service,$properties,$config)
145 146
 	{
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			if(is_array($config))
78 78
 			{
79 79
 				foreach($config['json'] as $id => $json)
80
-					$this->_services[$id] = $json;
80
+					$this->_services[$id]=$json;
81 81
 			}
82 82
 		}
83 83
 		else
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
 					$service=Prado::createComponent($serviceConfig['class']);
110 110
 					if($service instanceof TJsonResponse)
111 111
 					{
112
-						$properties = isset($serviceConfig['properties'])?$serviceConfig['properties']:array();
113
-						$this->createJsonResponse($service,$properties,$serviceConfig);
112
+						$properties=isset($serviceConfig['properties']) ? $serviceConfig['properties'] : array();
113
+						$this->createJsonResponse($service, $properties, $serviceConfig);
114 114
 					}
115 115
 					else
116
-						throw new TConfigurationException('jsonservice_response_type_invalid',$id);
116
+						throw new TConfigurationException('jsonservice_response_type_invalid', $id);
117 117
 				}
118 118
 				else
119
-					throw new TConfigurationException('jsonservice_class_required',$id);
119
+					throw new TConfigurationException('jsonservice_class_required', $id);
120 120
 			}
121 121
 			else
122 122
 			{
@@ -125,33 +125,33 @@  discard block
 block discarded – undo
125 125
 				{
126 126
 					$service=Prado::createComponent($class);
127 127
 					if($service instanceof TJsonResponse)
128
-						$this->createJsonResponse($service,$properties,$serviceConfig);
128
+						$this->createJsonResponse($service, $properties, $serviceConfig);
129 129
 					else
130
-						throw new TConfigurationException('jsonservice_response_type_invalid',$id);
130
+						throw new TConfigurationException('jsonservice_response_type_invalid', $id);
131 131
 				}
132 132
 				else
133
-					throw new TConfigurationException('jsonservice_class_required',$id);
133
+					throw new TConfigurationException('jsonservice_class_required', $id);
134 134
 			}
135 135
 		}
136 136
 		else
137
-			throw new THttpException(404,'jsonservice_provider_unknown',$id);
137
+			throw new THttpException(404, 'jsonservice_provider_unknown', $id);
138 138
 	}
139 139
 
140 140
 	/**
141 141
 	 * Renders content provided by TJsonResponse::getJsonContent() as
142 142
 	 * javascript in JSON format.
143 143
 	 */
144
-	protected function createJsonResponse($service,$properties,$config)
144
+	protected function createJsonResponse($service, $properties, $config)
145 145
 	{
146 146
 		// init service properties
147 147
 		foreach($properties as $name=>$value)
148
-			$service->setSubproperty($name,$value);
148
+			$service->setSubproperty($name, $value);
149 149
 		$service->init($config);
150 150
 
151 151
 		//send content if not null
152 152
 		if(($content=$service->getJsonContent())!==null)
153 153
 		{
154
-			$response = $this->getResponse();
154
+			$response=$this->getResponse();
155 155
 			$response->setContentType('application/json');
156 156
 			$response->setCharset('UTF-8');
157 157
 			//send content
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@  discard block
 block discarded – undo
79 79
 				foreach($config['json'] as $id => $json)
80 80
 					$this->_services[$id] = $json;
81 81
 			}
82
-		}
83
-		else
82
+		} else
84 83
 		{
85 84
 			foreach($config->getElementsByTagName('json') as $json)
86 85
 			{
@@ -111,14 +110,11 @@  discard block
 block discarded – undo
111 110
 					{
112 111
 						$properties = isset($serviceConfig['properties'])?$serviceConfig['properties']:array();
113 112
 						$this->createJsonResponse($service,$properties,$serviceConfig);
114
-					}
115
-					else
113
+					} else
116 114
 						throw new TConfigurationException('jsonservice_response_type_invalid',$id);
117
-				}
118
-				else
115
+				} else
119 116
 					throw new TConfigurationException('jsonservice_class_required',$id);
120
-			}
121
-			else
117
+			} else
122 118
 			{
123 119
 				$properties=$serviceConfig->getAttributes();
124 120
 				if(($class=$properties->remove('class'))!==null)
@@ -128,12 +124,10 @@  discard block
 block discarded – undo
128 124
 						$this->createJsonResponse($service,$properties,$serviceConfig);
129 125
 					else
130 126
 						throw new TConfigurationException('jsonservice_response_type_invalid',$id);
131
-				}
132
-				else
127
+				} else
133 128
 					throw new TConfigurationException('jsonservice_class_required',$id);
134 129
 			}
135
-		}
136
-		else
130
+		} else
137 131
 			throw new THttpException(404,'jsonservice_provider_unknown',$id);
138 132
 	}
139 133
 
Please login to merge, or discard this patch.
framework/Web/THttpResponseAdapter.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -31,6 +31,7 @@
 block discarded – undo
31 31
 	/**
32 32
 	 * Constructor. Attach a response to be adapted.
33 33
 	 * @param THttpResponse the response object the adapter is to attach to.
34
+	 * @param THttpResponse $response
34 35
 	 */
35 36
 	public function __construct($response)
36 37
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
 	 */
72 72
 	public function createNewHtmlWriter($type, $writer)
73 73
 	{
74
-		return $this->_response->createNewHtmlWriter($type,$writer);
74
+		return $this->_response->createNewHtmlWriter($type, $writer);
75 75
 	}
76 76
 }
77 77
 
Please login to merge, or discard this patch.
framework/Web/THttpSession.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -265,6 +265,7 @@  discard block
 block discarded – undo
265 265
 	 * If true, make sure the methods {@link _open}, {@link _close}, {@link _read},
266 266
 	 * {@link _write}, {@link _destroy}, and {@link _gc} are overridden in child
267 267
 	 * class, because they will be used as the callback handlers.
268
+	 * @param boolean $value
268 269
 	 */
269 270
 	public function setUseCustomStorage($value)
270 271
 	{
@@ -527,6 +528,7 @@  discard block
 block discarded – undo
527 528
 	 * Returns the session variable value with the session variable name.
528 529
 	 * This method is exactly the same as {@link offsetGet}.
529 530
 	 * @param mixed the session variable name
531
+	 * @param string $key
530 532
 	 * @return mixed the session variable value, null if no such variable exists
531 533
 	 */
532 534
 	public function itemAt($key)
@@ -539,6 +541,7 @@  discard block
 block discarded – undo
539 541
 	 * Note, if the specified name already exists, the old value will be removed first.
540 542
 	 * @param mixed session variable name
541 543
 	 * @param mixed session variable value
544
+	 * @param string $key
542 545
 	 */
543 546
 	public function add($key,$value)
544 547
 	{
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -309,13 +309,11 @@  discard block
 block discarded – undo
309 309
       {
310 310
 				ini_set('session.use_cookies','0');
311 311
 			  ini_set('session.use_only_cookies','0');
312
-      }
313
-			else if($value===THttpSessionCookieMode::Allow)
312
+      } else if($value===THttpSessionCookieMode::Allow)
314 313
 			{
315 314
 				ini_set('session.use_cookies','1');
316 315
 				ini_set('session.use_only_cookies','0');
317
-			}
318
-			else
316
+			} else
319 317
 			{
320 318
 				ini_set('session.use_cookies','1');
321 319
 				ini_set('session.use_only_cookies','1');
@@ -368,8 +366,7 @@  discard block
 block discarded – undo
368 366
 			{
369 367
 				ini_set('session.gc_probability',$value);
370 368
 				ini_set('session.gc_divisor','100');
371
-			}
372
-			else
369
+			} else
373 370
 				throw new TInvalidDataValueException('httpsession_gcprobability_invalid',$value);
374 371
 		}
375 372
 	}
@@ -557,8 +554,7 @@  discard block
 block discarded – undo
557 554
 			$value=$_SESSION[$key];
558 555
 			unset($_SESSION[$key]);
559 556
 			return $value;
560
-		}
561
-		else
557
+		} else
562 558
 			return null;
563 559
 	}
564 560
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 		if(!$this->_started)
140 140
 		{
141 141
 			if($this->_customStorage)
142
-				session_set_save_handler(array($this,'_open'),array($this,'_close'),array($this,'_read'),array($this,'_write'),array($this,'_destroy'),array($this,'_gc'));
142
+				session_set_save_handler(array($this, '_open'), array($this, '_close'), array($this, '_read'), array($this, '_write'), array($this, '_destroy'), array($this, '_gc'));
143 143
 			if($this->_cookie!==null)
144
-				session_set_cookie_params($this->_cookie->getExpire(),$this->_cookie->getPath(),$this->_cookie->getDomain(),$this->_cookie->getSecure(),$this->_cookie->getHttpOnly());
144
+				session_set_cookie_params($this->_cookie->getExpire(), $this->_cookie->getPath(), $this->_cookie->getDomain(), $this->_cookie->getSecure(), $this->_cookie->getHttpOnly());
145 145
 			if(ini_get('session.auto_start')!=='1')
146 146
 				session_start();
147 147
 			$this->_started=true;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function regenerate($deleteOld=false)
183 183
 	{
184
-		$old = $this->getSessionID();
184
+		$old=$this->getSessionID();
185 185
 		session_regenerate_id($deleteOld);
186 186
 		return $old;
187 187
 	}
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 		else if(ctype_alnum($value))
234 234
 			session_name($value);
235 235
 		else
236
-			throw new TInvalidDataValueException('httpsession_sessionname_invalid',$value);
236
+			throw new TInvalidDataValueException('httpsession_sessionname_invalid', $value);
237 237
 	}
238 238
 
239 239
 	/**
@@ -254,10 +254,10 @@  discard block
 block discarded – undo
254 254
 			throw new TInvalidOperationException('httpsession_savepath_unchangeable');
255 255
 		elseif(is_dir($value))
256 256
 			session_save_path(realpath($value));
257
-		elseif(null !== ($ns = Prado::getPathOfNamespace($value)) && is_dir($ns))
257
+		elseif(null!==($ns=Prado::getPathOfNamespace($value)) && is_dir($ns))
258 258
 			session_save_path(realpath($ns));
259 259
 		else
260
-			throw new TInvalidDataValueException('httpsession_savepath_invalid',$value);
260
+			throw new TInvalidDataValueException('httpsession_savepath_invalid', $value);
261 261
 	}
262 262
 
263 263
 	/**
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	public function getCookie()
286 286
 	{
287 287
 		if($this->_cookie===null)
288
-			$this->_cookie=new THttpCookie($this->getSessionName(),$this->getSessionID());
288
+			$this->_cookie=new THttpCookie($this->getSessionName(), $this->getSessionID());
289 289
 		return $this->_cookie;
290 290
 	}
291 291
 
@@ -312,21 +312,21 @@  discard block
 block discarded – undo
312 312
 			throw new TInvalidOperationException('httpsession_cookiemode_unchangeable');
313 313
 		else
314 314
 		{
315
-			$value=TPropertyValue::ensureEnum($value,'Prado\\Web\\THttpSessionCookieMode');
315
+			$value=TPropertyValue::ensureEnum($value, 'Prado\\Web\\THttpSessionCookieMode');
316 316
 			if($value===THttpSessionCookieMode::None) 
317 317
       {
318
-				ini_set('session.use_cookies','0');
319
-			  ini_set('session.use_only_cookies','0');
318
+				ini_set('session.use_cookies', '0');
319
+			  ini_set('session.use_only_cookies', '0');
320 320
       }
321 321
 			else if($value===THttpSessionCookieMode::Allow)
322 322
 			{
323
-				ini_set('session.use_cookies','1');
324
-				ini_set('session.use_only_cookies','0');
323
+				ini_set('session.use_cookies', '1');
324
+				ini_set('session.use_only_cookies', '0');
325 325
 			}
326 326
 			else
327 327
 			{
328
-				ini_set('session.use_cookies','1');
329
-				ini_set('session.use_only_cookies','1');
328
+				ini_set('session.use_cookies', '1');
329
+				ini_set('session.use_only_cookies', '1');
330 330
 				ini_set('session.use_trans_sid', 0);
331 331
 			}
332 332
 		}
@@ -372,13 +372,13 @@  discard block
 block discarded – undo
372 372
 		else
373 373
 		{
374 374
 			$value=TPropertyValue::ensureInteger($value);
375
-			if($value>=0 && $value<=100)
375
+			if($value >= 0 && $value <= 100)
376 376
 			{
377
-				ini_set('session.gc_probability',$value);
378
-				ini_set('session.gc_divisor','100');
377
+				ini_set('session.gc_probability', $value);
378
+				ini_set('session.gc_divisor', '100');
379 379
 			}
380 380
 			else
381
-				throw new TInvalidDataValueException('httpsession_gcprobability_invalid',$value);
381
+				throw new TInvalidDataValueException('httpsession_gcprobability_invalid', $value);
382 382
 		}
383 383
 	}
384 384
 
@@ -400,9 +400,9 @@  discard block
 block discarded – undo
400 400
 		else
401 401
 		{
402 402
 			$value=TPropertyValue::ensureBoolean($value);
403
-			if ($value && $this->getCookieMode()==THttpSessionCookieMode::Only)
403
+			if($value && $this->getCookieMode()==THttpSessionCookieMode::Only)
404 404
 					throw new TInvalidOperationException('httpsession_transid_cookieonly');
405
-			ini_set('session.use_trans_sid',$value?'1':'0');
405
+			ini_set('session.use_trans_sid', $value ? '1' : '0');
406 406
 		}
407 407
 	}
408 408
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 		if($this->_started)
424 424
 			throw new TInvalidOperationException('httpsession_maxlifetime_unchangeable');
425 425
 		else
426
-			ini_set('session.gc_maxlifetime',$value);
426
+			ini_set('session.gc_maxlifetime', $value);
427 427
 	}
428 428
 
429 429
 	/**
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	 * @param string session name
434 434
 	 * @return boolean whether session is opened successfully
435 435
 	 */
436
-	public function _open($savePath,$sessionName)
436
+	public function _open($savePath, $sessionName)
437 437
 	{
438 438
 		return true;
439 439
 	}
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 * @param string session data
467 467
 	 * @return boolean whether session write is successful
468 468
 	 */
469
-	public function _write($id,$data)
469
+	public function _write($id, $data)
470 470
 	{
471 471
 		return true;
472 472
 	}
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	 * @param mixed session variable name
549 549
 	 * @param mixed session variable value
550 550
 	 */
551
-	public function add($key,$value)
551
+	public function add($key, $value)
552 552
 	{
553 553
 		$_SESSION[$key]=$value;
554 554
 	}
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 	 * @param integer the offset to set element
622 622
 	 * @param mixed the element value
623 623
 	 */
624
-	public function offsetSet($offset,$item)
624
+	public function offsetSet($offset, $item)
625 625
 	{
626 626
 		$_SESSION[$offset]=$item;
627 627
 	}
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -314,10 +314,10 @@
 block discarded – undo
314 314
 		{
315 315
 			$value=TPropertyValue::ensureEnum($value,'Prado\\Web\\THttpSessionCookieMode');
316 316
 			if($value===THttpSessionCookieMode::None) 
317
-      {
317
+	  {
318 318
 				ini_set('session.use_cookies','0');
319 319
 			  ini_set('session.use_only_cookies','0');
320
-      }
320
+	  }
321 321
 			else if($value===THttpSessionCookieMode::Allow)
322 322
 			{
323 323
 				ini_set('session.use_cookies','1');
Please login to merge, or discard this patch.