Completed
Pull Request — developer (#4001)
by Thom
542:26 queued 508:45
created
libraries/antlr/CharStream.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -39,6 +39,7 @@  discard block
 block discarded – undo
39 39
 	/** For infinite streams, you don't need this; primarily I'm providing
40 40
 	 *  a useful interface for action code.  Just make sure actions don't
41 41
 	 *  use this on streams that don't support it.
42
+	 * @return string
42 43
 	 */
43 44
 	public function substring($start, $stop);
44 45
 
@@ -55,6 +56,9 @@  discard block
 block discarded – undo
55 56
 	/** Because this stream can rewind, we need to be able to reset the line */
56 57
 	public function setLine($line);
57 58
 
59
+	/**
60
+	 * @return void
61
+	 */
58 62
 	public function setCharPositionInLine($pos);
59 63
 
60 64
 	/** The index of the character relative to the beginning of the line 0..n-1 */
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 */
29 29
 
30 30
 
31
-class CharStreamConst{
31
+class CharStreamConst {
32 32
 	public static $EOF = -1;
33 33
 }
34 34
 $CharStream_EOF = -1;
Please login to merge, or discard this patch.
libraries/antlr/CommonTokenStream.php 4 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -62,6 +62,9 @@  discard block
 block discarded – undo
62 62
      */
63 63
     protected $p = -1;
64 64
 
65
+	/**
66
+	 * @param VTEventConditionParserLexer $tokenSource
67
+	 */
65 68
 	public function __construct($tokenSource, $channel=null) {
66 69
 		$this->channel = TokenConst::$DEFAULT_CHANNEL;
67 70
 		$this->tokens = array();
@@ -131,6 +134,7 @@  discard block
 block discarded – undo
131 134
 
132 135
 	/** Given a starting index, return the index of the first on-channel
133 136
 	 *  token.
137
+	 * @param integer $i
134 138
 	 */
135 139
 	protected function skipOffTokenChannels($i) {
136 140
 		$n = sizeof($this->tokens);
@@ -346,6 +350,9 @@  discard block
 block discarded – undo
346 350
 		return $this->toStringBetween(0, sizeof($this->tokens)-1);
347 351
 	}
348 352
 
353
+	/**
354
+	 * @param integer $start
355
+	 */
349 356
 	public function toStringBetween($start, $stop) {
350 357
 		if ( $start<0 || $stop<0 ) {
351 358
 			return null;
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
      */
63 63
     protected $p = -1;
64 64
 
65
-	public function __construct($tokenSource, $channel=null) {
65
+	public function __construct($tokenSource, $channel = null) {
66 66
 		$this->channel = TokenConst::$DEFAULT_CHANNEL;
67 67
 		$this->tokens = array();
68 68
 		$this->tokenSource = $tokenSource;
69
-		if($channel != null){
69
+		if ($channel != null) {
70 70
 			$this->channel = $channel;
71 71
 		}
72 72
 	}
@@ -86,24 +86,24 @@  discard block
 block discarded – undo
86 86
 	protected function fillBuffer() {
87 87
 		$index = 0;
88 88
 		$t = $this->tokenSource->nextToken();
89
-		while ( $t!=null && $t->getType()!=CharStreamConst::$EOF ) {
89
+		while ($t != null && $t->getType() != CharStreamConst::$EOF) {
90 90
 			$discard = false;
91 91
 			// is there a channel override for token type?
92
-			if ( $this->channelOverrideMap!=null ) {
92
+			if ($this->channelOverrideMap != null) {
93 93
 				$channelI = $this->channelOverrideMap[$t->getType()];
94
-				if ( $channelI!=null ) {
94
+				if ($channelI != null) {
95 95
 					$t->setChannel($channelI);
96 96
 				}
97 97
 			}
98
-			if ( $this->discardSet!=null &&
98
+			if ($this->discardSet != null &&
99 99
 				 $this->discardSet->contains($t->getType()))
100 100
 			{
101 101
 				$discard = true;
102 102
 			}
103
-			else if ( $this->discardOffChannelTokens && $t->getChannel()!=$this->channel ) {
103
+			else if ($this->discardOffChannelTokens && $t->getChannel() != $this->channel) {
104 104
 				$discard = true;
105 105
 			}
106
-			if ( !$discard )	{
106
+			if (!$discard) {
107 107
 				$t->setTokenIndex($index);
108 108
 				$this->tokens[] = $t;
109 109
 				$index++;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 *  Walk past any token not on the channel the parser is listening to.
124 124
 	 */
125 125
 	public function consume() {
126
-		if ( $this->p<sizeof($this->tokens)) {
126
+		if ($this->p < sizeof($this->tokens)) {
127 127
             $this->p++;
128 128
 			$this->p = $this->skipOffTokenChannels($this->p); // leave p on valid token
129 129
         }
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	protected function skipOffTokenChannels($i) {
136 136
 		$n = sizeof($this->tokens);
137
-		while ( $i<$n && $this->tokens[$i]->getChannel()!=$this->channel ) {
137
+		while ($i < $n && $this->tokens[$i]->getChannel() != $this->channel) {
138 138
 			$i++;
139 139
 		}
140 140
 		return $i;
141 141
 	}
142 142
 
143 143
 	protected function skipOffTokenChannelsReverse($i) {
144
-		while ( $i>=0 && $this->tokens[$i]->getChannel()!=$this->channel) {
144
+		while ($i >= 0 && $this->tokens[$i]->getChannel() != $this->channel) {
145 145
 			$i--;
146 146
 		}
147 147
 		return $i;
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 	 *  channel.
155 155
 	 */
156 156
 	public function setTokenTypeChannel($ttype, $channel) {
157
-		if ( $this->channelOverrideMap==null ) {
157
+		if ($this->channelOverrideMap == null) {
158 158
 			$this->channelOverrideMap = array();
159 159
 		}
160 160
         $this->channelOverrideMap[$ttype] = $channel;
161 161
 	}
162 162
 
163 163
 	public function discardTokenType($ttype) {
164
-		if ( $this->discardSet==null ) {
164
+		if ($this->discardSet == null) {
165 165
 			$this->discardSet = new Set();
166 166
 		}
167
-        $this->discardSet.add($ttype);
167
+        $this->discardSet . add($ttype);
168 168
 	}
169 169
 
170 170
 	public function discardOffChannelTokens($discardOffChannelTokens) {
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	}
173 173
 
174 174
 	public function getTokens() {
175
-		if ( $this->p == -1 ) {
175
+		if ($this->p == -1) {
176 176
 			$this->fillBuffer();
177 177
 		}
178 178
 		return $this->tokens;
@@ -187,35 +187,35 @@  discard block
 block discarded – undo
187 187
 	 *  method looks at both on and off channel tokens.
188 188
 	 */
189 189
 	public function getTokensOfTypeInSet($start, $stop, $types) {
190
-		if ( $p == -1 ) {
190
+		if ($p == -1) {
191 191
 			fillBuffer();
192 192
 		}
193
-		if ( $stop>=sizeof($this->tokens)) {
194
-			$stop=sizeof($this->tokens) - 1;
193
+		if ($stop >= sizeof($this->tokens)) {
194
+			$stop = sizeof($this->tokens) - 1;
195 195
 		}
196
-		if ( $start<0 ) {
197
-			$start=0;
196
+		if ($start < 0) {
197
+			$start = 0;
198 198
 		}
199
-		if ( $start>$stop ) {
199
+		if ($start > $stop) {
200 200
 			return null;
201 201
 		}
202 202
 
203 203
 		// list = tokens[start:stop]:{Token t, t.getType() in types}
204 204
 		$filteredTokens = array();
205
-		for ($i=$start; $i<=$stop; $i++) {
205
+		for ($i = $start; $i <= $stop; $i++) {
206 206
 			$t = $this->tokens[$i];
207
-			if ( $types==null || $types->member($t->getType())) {
207
+			if ($types == null || $types->member($t->getType())) {
208 208
 				$filteredTokens->add($t);
209 209
 			}
210 210
 		}
211
-		if ( sizeof($filteredTokens)==0 ) {
211
+		if (sizeof($filteredTokens) == 0) {
212 212
 			$filteredTokens = null;
213 213
 		}
214 214
 		return $filteredTokens;
215 215
 	}
216 216
 
217 217
 	public function getTokensOfTypeInArray($start, $stop, $types) {
218
-		return $this->getTokens($start, $stop,new Set(types));
218
+		return $this->getTokens($start, $stop, new Set(types));
219 219
 	}
220 220
 
221 221
 	public function getTokensofType($start, $stop, $ttype) {
@@ -226,29 +226,29 @@  discard block
 block discarded – undo
226 226
 	 *  first symbol of lookahead.
227 227
 	 */
228 228
 	public function LT($k) {
229
-		if ( $this->p == -1 ) {
229
+		if ($this->p == -1) {
230 230
 			$this->fillBuffer();
231 231
 		}
232
-		if ( $k==0 ) {
232
+		if ($k == 0) {
233 233
 			return null;
234 234
 		}
235
-		if ( $k<0 ) {
235
+		if ($k < 0) {
236 236
 			return $this->LB(-$k);
237 237
 		}
238 238
 		//System.out.print("LT(p="+p+","+k+")=");
239
-		if ( ($this->p+$k-1) >= sizeof($this->tokens)) {
239
+		if (($this->p + $k - 1) >= sizeof($this->tokens)) {
240 240
 			return TokenConst::$EOF_TOKEN;
241 241
 		}
242 242
 		//System.out.println(tokens.get(p+k-1));
243 243
 		$i = $this->p;
244 244
 		$n = 1;
245 245
 		// find k good tokens
246
-		while ( $n<$k ) {
246
+		while ($n < $k) {
247 247
 			// skip off-channel tokens
248
-			$i = $this->skipOffTokenChannels($i+1); // leave p on valid token
248
+			$i = $this->skipOffTokenChannels($i + 1); // leave p on valid token
249 249
 			$n++;
250 250
 		}
251
-		if ( $i>=sizeof($this->tokens)) {
251
+		if ($i >= sizeof($this->tokens)) {
252 252
 			return TokenConst::$EOF_TOKEN;
253 253
 		}
254 254
         return $this->tokens[$i];
@@ -257,13 +257,13 @@  discard block
 block discarded – undo
257 257
 	/** Look backwards k tokens on-channel tokens */
258 258
 	protected function LB($k) {
259 259
 		//System.out.print("LB(p="+p+","+k+") ");
260
-		if ( $this->p == -1 ) {
260
+		if ($this->p == -1) {
261 261
 			$this->fillBuffer();
262 262
 		}
263
-		if ( $k==0 ) {
263
+		if ($k == 0) {
264 264
 			return null;
265 265
 		}
266
-		if ( ($this->p-$k)<0 ) {
266
+		if (($this->p - $k) < 0) {
267 267
 			return null;
268 268
 		}
269 269
 		
@@ -271,12 +271,12 @@  discard block
 block discarded – undo
271 271
 		$i = $this->p;
272 272
 		$n = 1;
273 273
 		// find k good tokens looking backwards
274
-		while ( $n<=$k ) {
274
+		while ($n <= $k) {
275 275
 			// skip off-channel tokens
276
-			$i = $this->skipOffTokenChannelsReverse($i-1); // leave p on valid token
276
+			$i = $this->skipOffTokenChannelsReverse($i - 1); // leave p on valid token
277 277
 			$n++;
278 278
 		}
279
-		if ( $i<0 ) {
279
+		if ($i < 0) {
280 280
 			return null;
281 281
 		}
282 282
 		return $this->tokens[$i];
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     }
296 296
 
297 297
     public function mark() {
298
-		if ( $this->p == -1 ) {
298
+		if ($this->p == -1) {
299 299
 			$this->fillBuffer();
300 300
 		}
301 301
 		$this->lastMarker = $this->index();
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
     }
316 316
 
317 317
 	public function rewind($marker = null) {
318
-		if($marker===null){
318
+		if ($marker === null) {
319 319
 			$marker = $this->lastmarker;
320 320
 		}
321 321
 		$this->seek($marker);
@@ -340,38 +340,38 @@  discard block
 block discarded – undo
340 340
 	}
341 341
 
342 342
 	public function toString() {
343
-		if ( $this->p == -1 ) {
343
+		if ($this->p == -1) {
344 344
 			$this->fillBuffer();
345 345
 		}
346
-		return $this->toStringBetween(0, sizeof($this->tokens)-1);
346
+		return $this->toStringBetween(0, sizeof($this->tokens) - 1);
347 347
 	}
348 348
 
349 349
 	public function toStringBetween($start, $stop) {
350
-		if ( $start<0 || $stop<0 ) {
350
+		if ($start < 0 || $stop < 0) {
351 351
 			return null;
352 352
 		}
353
-		if ( $this->p == -1 ) {
353
+		if ($this->p == -1) {
354 354
 			$this->fillBuffer();
355 355
 		}
356
-		if ( $stop>=sizeof($this->tokens)) {
357
-			$stop = sizeof($this->tokens)-1;
356
+		if ($stop >= sizeof($this->tokens)) {
357
+			$stop = sizeof($this->tokens) - 1;
358 358
 		}
359 359
 		$buf = "";
360 360
 		for ($i = $start; $i <= $stop; $i++) {
361 361
 			$t = $this->tokens[$i];
362
-			$buf.=$t->getText();
362
+			$buf .= $t->getText();
363 363
 		}
364 364
 		return $buf;
365 365
 	}
366 366
 
367 367
 	public function toStringBetweenTokens($start, $stop) {
368
-		if ( $start!=null && $stop!=null ) {
368
+		if ($start != null && $stop != null) {
369 369
 			return toString($this->start->getTokenIndex(), $this->stop->getTokenIndex());
370 370
 		}
371 371
 		return null;
372 372
 	}
373 373
 	
374
-	public function __toString(){
374
+	public function __toString() {
375 375
 		return $this->toString();
376 376
 	}
377 377
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,8 +99,7 @@
 block discarded – undo
99 99
 				 $this->discardSet->contains($t->getType()))
100 100
 			{
101 101
 				$discard = true;
102
-			}
103
-			else if ( $this->discardOffChannelTokens && $t->getChannel()!=$this->channel ) {
102
+			} else if ( $this->discardOffChannelTokens && $t->getChannel()!=$this->channel ) {
104 103
 				$discard = true;
105 104
 			}
106 105
 			if ( !$discard )	{
Please login to merge, or discard this patch.
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 */
29 29
 
30 30
 class CommonTokenStream implements TokenStream {
31
-    protected $tokenSource;
31
+	protected $tokenSource;
32 32
 
33 33
 	/** Record every single token pulled from the source so we can reproduce
34 34
 	 *  chunks of it later.
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 	protected $lastMarker = 0;
52 52
 
53 53
 	/** The index into the tokens list of the current token (next token
54
-     *  to consume).  p==-1 indicates that the tokens list is empty
55
-     */
56
-    protected $p = -1;
54
+	 *  to consume).  p==-1 indicates that the tokens list is empty
55
+	 */
56
+	protected $p = -1;
57 57
 
58 58
 	public function __construct($tokenSource, $channel=null) {
59 59
 		$this->channel = TokenConst::$DEFAULT_CHANNEL;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		// leave p pointing at first token on channel
107 107
 		$this->p = 0;
108 108
 		$this->p = $this->skipOffTokenChannels($this->p);
109
-    }
109
+	}
110 110
 
111 111
 	/** Move the input pointer to the next incoming token.  The stream
112 112
 	 *  must become active with LT(1) available.  consume() simply
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function consume() {
119 119
 		if ( $this->p<sizeof($this->tokens)) {
120
-            $this->p++;
120
+			$this->p++;
121 121
 			$this->p = $this->skipOffTokenChannels($this->p); // leave p on valid token
122
-        }
123
-    }
122
+		}
123
+	}
124 124
 
125 125
 	/** Given a starting index, return the index of the first on-channel
126 126
 	 *  token.
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
 		if ( $this->channelOverrideMap==null ) {
151 151
 			$this->channelOverrideMap = array();
152 152
 		}
153
-        $this->channelOverrideMap[$ttype] = $channel;
153
+		$this->channelOverrideMap[$ttype] = $channel;
154 154
 	}
155 155
 
156 156
 	public function discardTokenType($ttype) {
157 157
 		if ( $this->discardSet==null ) {
158 158
 			$this->discardSet = new Set();
159 159
 		}
160
-        $this->discardSet.add($ttype);
160
+		$this->discardSet.add($ttype);
161 161
 	}
162 162
 
163 163
 	public function discardOffChannelTokens($discardOffChannelTokens) {
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
 		if ( $i>=sizeof($this->tokens)) {
245 245
 			return TokenConst::$EOF_TOKEN;
246 246
 		}
247
-        return $this->tokens[$i];
248
-    }
247
+		return $this->tokens[$i];
248
+	}
249 249
 
250 250
 	/** Look backwards k tokens on-channel tokens */
251 251
 	protected function LB($k) {
@@ -282,12 +282,12 @@  discard block
 block discarded – undo
282 282
 		return $this->tokens[$i];
283 283
 	}
284 284
 
285
-    public function LA($i) {
285
+	public function LA($i) {
286 286
 		$lt = $this->LT($i);
287
-        return $this->LT($i)->getType();
288
-    }
287
+		return $this->LT($i)->getType();
288
+	}
289 289
 
290
-    public function mark() {
290
+	public function mark() {
291 291
 		if ( $this->p == -1 ) {
292 292
 			$this->fillBuffer();
293 293
 		}
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 		return sizeof($this->tokens);
304 304
 	}
305 305
 
306
-    public function index() {
307
-        return $this->p;
308
-    }
306
+	public function index() {
307
+		return $this->p;
308
+	}
309 309
 
310 310
 	public function rewind($marker = null) {
311 311
 		if($marker===null){
Please login to merge, or discard this patch.
libraries/antlr/DFA.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -191,6 +191,7 @@
 block discarded – undo
191 191
 	 *  like "\1\2\3\9", convert to short[] {2,9,9,9}.  We do this to avoid
192 192
 	 *  static short[] which generates so much init code that the class won't
193 193
 	 *  compile. :(
194
+	 * @param string $encodedString
194 195
 	 */
195 196
 	public static function unpackEncodedString($encodedString) {
196 197
 		$data = array();
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@
 block discarded – undo
42 42
 	protected $eot;
43 43
 	protected $eof;
44 44
 	protected $min;
45
-    protected $max;
46
-    protected $accept;
47
-    protected $special;
48
-    protected $transition;
45
+	protected $max;
46
+	protected $accept;
47
+	protected $special;
48
+	protected $transition;
49 49
 
50 50
 	protected $decisionNumber;
51 51
 
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
 	 *  an exception upon error.
61 61
 	 */
62 62
 	
63
-	public function predict($input){
64
-		if ( $this->debug ) {
65
-			echo ("Enter DFA.predict for decision ".$this->decisionNumber);
63
+	public function predict($input) {
64
+		if ($this->debug) {
65
+			echo ("Enter DFA.predict for decision " . $this->decisionNumber);
66 66
 		}
67 67
 		$mark = $input->mark(); // remember where decision started in input
68 68
 		try {
69 69
 			$ret = $this->_predict($input);
70 70
 			
71 71
 		}
72
-		catch(Exception $e) {
72
+		catch (Exception $e) {
73 73
 			$input->rewind($mark);
74 74
 			throw $e;
75 75
 		}
@@ -79,20 +79,20 @@  discard block
 block discarded – undo
79 79
 	
80 80
 	public function _predict($input) {
81 81
 		$s = 0; // we always start at s0
82
-			while ( true ) {
83
-				if ( $this->debug ) echo ("DFA ".$this->decisionNumber." state ".$s." LA(1)=".$input->LA(1)."(".$input->LA(1)."), index=".$input->index());
82
+			while (true) {
83
+				if ($this->debug) echo ("DFA " . $this->decisionNumber . " state " . $s . " LA(1)=" . $input->LA(1) . "(" . $input->LA(1) . "), index=" . $input->index());
84 84
 				$specialState = $this->special[$s];
85
-				if ( $specialState>=0 ) {
86
-					if ( $this->debug ) {
87
-						echo ("DFA ".$this->decisionNumber.
88
-							" state ".$s." is special state ".$specialState);
85
+				if ($specialState >= 0) {
86
+					if ($this->debug) {
87
+						echo ("DFA " . $this->decisionNumber .
88
+							" state " . $s . " is special state " . $specialState);
89 89
 					}
90 90
 					$s = $this->specialStateTransition($specialState, $input);
91
-					if ( $this->debug ) {
92
-						echo ("DFA ".$this->decisionNumber.
93
-							" returns from special state ".$specialState." to ".s);
91
+					if ($this->debug) {
92
+						echo ("DFA " . $this->decisionNumber .
93
+							" returns from special state " . $specialState . " to " . s);
94 94
 					}
95
-					if ( $s==-1 ) {
95
+					if ($s == -1) {
96 96
 						$this->noViableAlt($s, $input);
97 97
 						return 0;
98 98
 					}
@@ -100,50 +100,50 @@  discard block
 block discarded – undo
100 100
 					continue;
101 101
 				}
102 102
 				
103
-				if ( $this->accept[$s] >= 1 ) {
104
-					if ( $this->debug ) echo ("accept; predict "+$this->accept[$s]+" from state "+$this->s);
103
+				if ($this->accept[$s] >= 1) {
104
+					if ($this->debug) echo ("accept; predict "+$this->accept[$s] + " from state "+$this->s);
105 105
 					return $this->accept[$s];
106 106
 				}
107 107
 				// look for a normal char transition
108 108
 				$c = $input->LA(1); // -1 == \uFFFF, all tokens fit in 65000 space
109
-				if ($c>=$this->min[$s] && $c<=$this->max[$s]) {
110
-					$snext = $this->transition[$s][$c-$this->min[$s]]; // move to next state
111
-					if ( $snext < 0 ) {
109
+				if ($c >= $this->min[$s] && $c <= $this->max[$s]) {
110
+					$snext = $this->transition[$s][$c - $this->min[$s]]; // move to next state
111
+					if ($snext < 0) {
112 112
 						// was in range but not a normal transition
113 113
 						// must check EOT, which is like the else clause.
114 114
 						// eot[s]>=0 indicates that an EOT edge goes to another
115 115
 						// state.
116
-						if ( $this->eot[$s]>=0 ) {  // EOT Transition to accept state?
117
-							if ( $this->debug ) echo("EOT transition");
116
+						if ($this->eot[$s] >= 0) {  // EOT Transition to accept state?
117
+							if ($this->debug) echo("EOT transition");
118 118
 							$s = $this->eot[$s];
119 119
 							$input->consume();
120 120
 							continue;
121 121
 						}
122
-						$this->noViableAlt($s,$input);
122
+						$this->noViableAlt($s, $input);
123 123
 						return 0;
124 124
 					}
125 125
 					$s = $snext;
126 126
 					$input->consume();
127 127
 					continue;
128 128
 				}
129
-				if ( $eot[$s]>=0 ) {  // EOT Transition?
130
-					if ( $this->debug ) println("EOT transition");
129
+				if ($eot[$s] >= 0) {  // EOT Transition?
130
+					if ($this->debug) println("EOT transition");
131 131
 					$s = $this->eot[$s];
132 132
 					$input->consume();
133 133
 					continue;
134 134
 				}
135
-				if ( $c==Token::$EOF && $eof[$s]>=0 ) {  // EOF Transition to accept state?
136
-					if ( $this->debug ) echo ("accept via EOF; predict "+$this->accept[$eof[$s]]+" from "+$eof[$s]);
135
+				if ($c == Token::$EOF && $eof[$s] >= 0) {  // EOF Transition to accept state?
136
+					if ($this->debug) echo ("accept via EOF; predict "+$this->accept[$eof[$s]] + " from "+$eof[$s]);
137 137
 					return $this->accept[$eof[$s]];
138 138
 				}
139 139
 				// not in range and not EOF/EOT, must be invalid symbol
140
-				if ( $this->debug ) {
141
-					echo("min[".$s."]=".$this->min[$s]);
142
-					echo("max[".$s."]=".$this->max[$s]);
143
-					echo("eot[".$s."]=".$this->eot[$s]);
144
-					echo("eof[".$s."]=".$this->eof[$s]);
145
-					for ($p=0; $p<$this->transition[$s]->length; $p++) {
146
-						echo $this->transition[$s][$p]+" ";
140
+				if ($this->debug) {
141
+					echo("min[" . $s . "]=" . $this->min[$s]);
142
+					echo("max[" . $s . "]=" . $this->max[$s]);
143
+					echo("eot[" . $s . "]=" . $this->eot[$s]);
144
+					echo("eof[" . $s . "]=" . $this->eof[$s]);
145
+					for ($p = 0; $p < $this->transition[$s]->length; $p++) {
146
+						echo $this->transition[$s][$p] + " ";
147 147
 					}
148 148
 					echo "\n";
149 149
 				}
@@ -153,9 +153,9 @@  discard block
 block discarded – undo
153 153
 
154 154
 	}
155 155
 
156
-	public function noViableAlt($s, $input){
157
-		if ($this->recognizer->state->backtracking>0) {
158
-			$this->recognizer->state->failed=true;
156
+	public function noViableAlt($s, $input) {
157
+		if ($this->recognizer->state->backtracking > 0) {
158
+			$this->recognizer->state->failed = true;
159 159
 			return;
160 160
 		}
161 161
 		$nvae =
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	}
169 169
 
170 170
 	/** A hook for debugging interface */
171
-	protected function error($nvae) { ; }
171
+	protected function error($nvae) {; }
172 172
 
173 173
 	public function specialStateTransition($s, $input)
174 174
 	{
@@ -187,19 +187,19 @@  discard block
 block discarded – undo
187 187
 	public static function unpackEncodedString($encodedString) {
188 188
 		$data = array();
189 189
 		$di = 0;
190
-		for ($i=0,$len=strlen($encodedString); $i<$len; $i+=2) {
190
+		for ($i = 0, $len = strlen($encodedString); $i < $len; $i += 2) {
191 191
 			$n = charAt($encodedString, $i);
192
-			$v = charAt($encodedString, $i+1);
192
+			$v = charAt($encodedString, $i + 1);
193 193
 			// add v n times to data
194
-			for ($j=1; $j<=$n; $j++) {
195
-				if($v==0xff) $v=-1;
194
+			for ($j = 1; $j <= $n; $j++) {
195
+				if ($v == 0xff) $v = -1;
196 196
 				$data[$di++] = $v;
197 197
 			}
198 198
 		}
199 199
 		return $data;
200 200
 	}
201 201
 	
202
-	public function __call($fn, $params){
202
+	public function __call($fn, $params) {
203 203
 		return call_user_func_array(array($this->recognizer, $fn), $params);
204 204
 	}
205 205
 }
Please login to merge, or discard this patch.
Braces   +19 added lines, -8 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@  discard block
 block discarded – undo
68 68
 		try {
69 69
 			$ret = $this->_predict($input);
70 70
 			
71
-		}
72
-		catch(Exception $e) {
71
+		} catch(Exception $e) {
73 72
 			$input->rewind($mark);
74 73
 			throw $e;
75 74
 		}
@@ -80,7 +79,9 @@  discard block
 block discarded – undo
80 79
 	public function _predict($input) {
81 80
 		$s = 0; // we always start at s0
82 81
 			while ( true ) {
83
-				if ( $this->debug ) echo ("DFA ".$this->decisionNumber." state ".$s." LA(1)=".$input->LA(1)."(".$input->LA(1)."), index=".$input->index());
82
+				if ( $this->debug ) {
83
+					echo ("DFA ".$this->decisionNumber." state ".$s." LA(1)=".$input->LA(1)."(".$input->LA(1)."), index=".$input->index());
84
+				}
84 85
 				$specialState = $this->special[$s];
85 86
 				if ( $specialState>=0 ) {
86 87
 					if ( $this->debug ) {
@@ -101,7 +102,9 @@  discard block
 block discarded – undo
101 102
 				}
102 103
 				
103 104
 				if ( $this->accept[$s] >= 1 ) {
104
-					if ( $this->debug ) echo ("accept; predict "+$this->accept[$s]+" from state "+$this->s);
105
+					if ( $this->debug ) {
106
+						echo ("accept; predict "+$this->accept[$s]+" from state "+$this->s);
107
+					}
105 108
 					return $this->accept[$s];
106 109
 				}
107 110
 				// look for a normal char transition
@@ -114,7 +117,9 @@  discard block
 block discarded – undo
114 117
 						// eot[s]>=0 indicates that an EOT edge goes to another
115 118
 						// state.
116 119
 						if ( $this->eot[$s]>=0 ) {  // EOT Transition to accept state?
117
-							if ( $this->debug ) echo("EOT transition");
120
+							if ( $this->debug ) {
121
+								echo("EOT transition");
122
+							}
118 123
 							$s = $this->eot[$s];
119 124
 							$input->consume();
120 125
 							continue;
@@ -127,13 +132,17 @@  discard block
 block discarded – undo
127 132
 					continue;
128 133
 				}
129 134
 				if ( $eot[$s]>=0 ) {  // EOT Transition?
130
-					if ( $this->debug ) println("EOT transition");
135
+					if ( $this->debug ) {
136
+						println("EOT transition");
137
+					}
131 138
 					$s = $this->eot[$s];
132 139
 					$input->consume();
133 140
 					continue;
134 141
 				}
135 142
 				if ( $c==Token::$EOF && $eof[$s]>=0 ) {  // EOF Transition to accept state?
136
-					if ( $this->debug ) echo ("accept via EOF; predict "+$this->accept[$eof[$s]]+" from "+$eof[$s]);
143
+					if ( $this->debug ) {
144
+						echo ("accept via EOF; predict "+$this->accept[$eof[$s]]+" from "+$eof[$s]);
145
+					}
137 146
 					return $this->accept[$eof[$s]];
138 147
 				}
139 148
 				// not in range and not EOF/EOT, must be invalid symbol
@@ -192,7 +201,9 @@  discard block
 block discarded – undo
192 201
 			$v = charAt($encodedString, $i+1);
193 202
 			// add v n times to data
194 203
 			for ($j=1; $j<=$n; $j++) {
195
-				if($v==0xff) $v=-1;
204
+				if($v==0xff) {
205
+					$v=-1;
206
+				}
196 207
 				$data[$di++] = $v;
197 208
 			}
198 209
 		}
Please login to merge, or discard this patch.
libraries/antlr/EarlyExitException.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -31,6 +31,9 @@
 block discarded – undo
31 31
 class EarlyExitException extends RecognitionException {
32 32
 	public $decisionNumber;
33 33
 
34
+	/**
35
+	 * @param integer $decisionNumber
36
+	 */
34 37
 	public function __construct($decisionNumber, $input) {
35 38
 		parent::__construct($input);
36 39
 		$this->decisionNumber = $decisionNumber;
Please login to merge, or discard this patch.
libraries/antlr/IntStream.php 3 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -31,12 +31,17 @@  discard block
 block discarded – undo
31 31
  *  or token type sequence (such as interpretation).
32 32
  */
33 33
 interface IntStream {
34
+
35
+	/**
36
+	 * @return void
37
+	 */
34 38
 	public function consume();
35 39
 
36 40
 	/** Get int at current input pointer + i ahead where i=1 is next int.
37 41
 	 *  Negative indexes are allowed.  LA(-1) is previous token (token
38 42
 	 *  just matched).  LA(-i) where i is before first token should
39 43
 	 *  yield -1, invalid char / EOF.
44
+	 * @param integer $i
40 45
 	 */
41 46
 	public function LA($i);
42 47
 
@@ -62,6 +67,7 @@  discard block
 block discarded – undo
62 67
 	 *  created after this marker argument, this routine must unroll them
63 68
 	 *  like a stack.  Assume the state the stream was in when this marker
64 69
 	 *  was created.
70
+	 * @return void
65 71
 	 */
66 72
 	public function rewind($marker=null);
67 73
 
@@ -72,6 +78,7 @@  discard block
 block discarded – undo
72 78
 	 *  This must throw away resources for all markers back to the marker
73 79
 	 *  argument.  So if you're nested 5 levels of mark(), and then release(2)
74 80
 	 *  you have to release resources for depths 2..5.
81
+	 * @return void
75 82
 	 */
76 83
 	public function release($marker);
77 84
 
@@ -94,6 +101,7 @@  discard block
 block discarded – undo
94 101
 	 *  The index is 0..n-1.  A seek to position i means that LA(1) will
95 102
 	 *  return the ith symbol.  So, seeking to 0 means LA(1) will return the
96 103
 	 *  first element in the stream. 
104
+	 * @return void
97 105
 	 */
98 106
 	public function seek($index);
99 107
 
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,18 +41,18 @@
 block discarded – undo
41 41
 	public function LA($i);
42 42
 
43 43
 	/** Tell the stream to start buffering if it hasn't already.  Return
44
-     *  current input position, index(), or some other marker so that
44
+	 *  current input position, index(), or some other marker so that
45 45
 	 *  when passed to rewind() you get back to the same spot.
46 46
 	 *  rewind(mark()) should not affect the input cursor.  The Lexer
47 47
 	 *  track line/col info as well as input index so its markers are
48 48
 	 *  not pure input indexes.  Same for tree node streams.
49
-     */
49
+	 */
50 50
 	public function mark();
51 51
 
52 52
 	/** Return the current input symbol index 0..n where n indicates the
53
-     *  last symbol has been read.  The index is the symbol about to be
53
+	 *  last symbol has been read.  The index is the symbol about to be
54 54
 	 *  read not the most recently read symbol.
55
-     */
55
+	 */
56 56
 	public function index();
57 57
 
58 58
 	/** Reset the stream so that next call to index would return marker.
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
 	 *  like a stack.  Assume the state the stream was in when this marker
64 64
 	 *  was created.
65 65
 	 */
66
-	public function rewind($marker=null);
66
+	public function rewind($marker = null);
67 67
 
68 68
 	/** You may want to commit to a backtrack but don't want to force the
69 69
 	 *  stream to keep bookkeeping objects around for a marker that is
Please login to merge, or discard this patch.
libraries/antlr/NoViableAltException.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -32,6 +32,9 @@
 block discarded – undo
32 32
 	public $decisionNumber;
33 33
 	public $stateNumber;
34 34
 
35
+	/**
36
+	 * @param string $grammarDecisionDescription
37
+	 */
35 38
 	public function __construct($grammarDecisionDescription,
36 39
 								$decisionNumber,
37 40
 								$stateNumber,
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@
 block discarded – undo
44 44
 	}
45 45
 
46 46
 	public function __toString() {
47
-		if ( $this->input instanceof CharStream ) {
48
-			return "NoViableAltException('".$this->getUnexpectedType()."'@[".$this->grammarDecisionDescription."])";
47
+		if ($this->input instanceof CharStream) {
48
+			return "NoViableAltException('" . $this->getUnexpectedType() . "'@[" . $this->grammarDecisionDescription . "])";
49 49
 		}
50 50
 		else {
51
-			return "NoViableAltException(".$this->getUnexpectedType()."@[".$this->grammarDecisionDescription."])";
51
+			return "NoViableAltException(" . $this->getUnexpectedType() . "@[" . $this->grammarDecisionDescription . "])";
52 52
 		}
53 53
 	}
54 54
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@
 block discarded – undo
46 46
 	public function __toString() {
47 47
 		if ( $this->input instanceof CharStream ) {
48 48
 			return "NoViableAltException('".$this->getUnexpectedType()."'@[".$this->grammarDecisionDescription."])";
49
-		}
50
-		else {
49
+		} else {
51 50
 			return "NoViableAltException(".$this->getUnexpectedType()."@[".$this->grammarDecisionDescription."])";
52 51
 		}
53 52
 	}
Please login to merge, or discard this patch.
libraries/antlr/Set.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -24,6 +24,9 @@
 block discarded – undo
24 24
 			$this->store = $this->union($otherSet)->store;
25 25
 		}
26 26
 		
27
+		/**
28
+		 * @param integer $value
29
+		 */
27 30
 		public function remove($value){
28 31
 			unset($this->store[$value]);
29 32
 		}
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@
 block discarded – undo
1 1
 <?php
2 2
 	//Todo: find a decent set implementation for php
3
-	class Set{
4
-		public function __construct($arr){
3
+	class Set {
4
+		public function __construct($arr) {
5 5
 			$this->store = array();
6
-			foreach($arr as $el){
6
+			foreach ($arr as $el) {
7 7
 				$this->store[$el] = $el;
8 8
 			}
9 9
 		}
10 10
 		
11
-		public function add($value){
11
+		public function add($value) {
12 12
 			$this->store[$value] = $value;
13 13
 		}
14 14
 		
15
-		public function member($value){
15
+		public function member($value) {
16 16
 			return array_key_exists($value, $this->store);
17 17
 		}
18 18
 		
19
-		public function union($otherSet){
19
+		public function union($otherSet) {
20 20
 			return new Set(array_merge($this->store, $otherSet->store));
21 21
 		}
22 22
 		
23
-		public function unionInPlace($otherSet){
23
+		public function unionInPlace($otherSet) {
24 24
 			$this->store = $this->union($otherSet)->store;
25 25
 		}
26 26
 		
27
-		public function remove($value){
27
+		public function remove($value) {
28 28
 			unset($this->store[$value]);
29 29
 		}
30 30
 	}
Please login to merge, or discard this patch.
libraries/antlr/TokenStream.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -55,6 +55,7 @@
 block discarded – undo
55 55
 	 *  If the stream does not buffer all the tokens then it can just
56 56
 	 *  return "" or null;  Users should not access $ruleLabel.text in
57 57
 	 *  an action of course in that case.
58
+	 * @return null|string
58 59
 	 */
59 60
 	public function toStringBetween($start, $stop);
60 61
 	
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,13 +29,13 @@
 block discarded – undo
29 29
 
30 30
 /** A stream of tokens accessing tokens from a TokenSource */
31 31
 interface TokenStream extends IntStream {
32
-    /** Get Token at current input pointer + i ahead where i=1 is next Token.
32
+	/** Get Token at current input pointer + i ahead where i=1 is next Token.
33 33
 	 *  i<0 indicates tokens in the past.  So -1 is previous token and -2 is
34 34
 	 *  two tokens ago. LT(0) is undefined.  For i>=n, return Token.EOFToken.
35 35
 	 *  Return null for LT(0) and any index that results in an absolute address
36 36
 	 *  that is negative.
37 37
 	 */
38
-    public function LT($k);
38
+	public function LT($k);
39 39
 
40 40
 	/** Get a token at an absolute index i; 0..n-1.  This is really only
41 41
 	 *  needed for profiling and debugging and token stream rewriting.
Please login to merge, or discard this patch.
libraries/HTTP_Session/Session.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 	 * Returns session variable
550 550
 	 *
551 551
 	 * @param string $name    Name of a variable
552
-	 * @param mixed  $default Default value of a variable if not set
552
+	 * @param string  $default Default value of a variable if not set
553 553
 	 *
554 554
 	 * @static
555 555
 	 * @access public
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 	 *
759 759
 	 * @static
760 760
 	 * @access public
761
-	 * @return bool   The previous value of the property
761
+	 * @return string   The previous value of the property
762 762
 	 */
763 763
 	public static function setGcMaxLifetime($gcMaxLifetime = null)
764 764
 	{
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 	 *
782 782
 	 * @static
783 783
 	 * @access public
784
-	 * @return bool   The previous value of the property
784
+	 * @return string   The previous value of the property
785 785
 	 */
786 786
 	public static function setGcProbability($gcProbability = null)
787 787
 	{
Please login to merge, or discard this patch.