Completed
Push — namespace-template ( 367a36...f9db4f )
by Sam
07:20
created

SSTemplateParser::match_NamespacedWord()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
rs 9.4285
1
<?php
2
3
/*
4
WARNING: This file has been machine generated. Do not edit it, or your changes will be overwritten next time it is compiled.
5
*/
6
7
8
9
10
// We want this to work when run by hand too
11 View Code Duplication
if (defined(THIRDPARTY_PATH)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
	require_once(THIRDPARTY_PATH . '/php-peg/Parser.php');
13
}
14
else {
15
	$base = dirname(__FILE__);
16
	require_once($base.'/../thirdparty/php-peg/Parser.php');
17
}
18
19
/**
20
 * This is the exception raised when failing to parse a template. Note that we don't currently do any static analysis,
21
 * so we can't know if the template will run, just if it's malformed. It also won't catch mistakes that still look
22
 * valid.
23
 *
24
 * @package framework
25
 * @subpackage view
26
 */
27 View Code Duplication
class SSTemplateParseException extends Exception {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
28
	
29
	function __construct($message, $parser) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
30
		$prior = substr($parser->string, 0, $parser->pos);
31
		
32
		preg_match_all('/\r\n|\r|\n/', $prior, $matches);
33
		$line = count($matches[0])+1;
34
		
35
		parent::__construct("Parse error in template on line $line. Error was: $message");
36
	}
37
	
38
}
39
40
/**
41
  * This is the parser for the SilverStripe template language. It gets called on a string and uses a php-peg parser
42
  * to match that string against the language structure, building up the PHP code to execute that structure as it
43
  * parses
44
  * 
45
  * The $result array that is built up as part of the parsing (see thirdparty/php-peg/README.md for more on how
46
  * parsers build results) has one special member, 'php', which contains the php equivalent of that part of the
47
  * template tree.
48
  * 
49
  * Some match rules generate alternate php, or other variations, so check the per-match documentation too.
50
  * 
51
  * Terms used:
52
  * 
53
  * Marked: A string or lookup in the template that has been explictly marked as such - lookups by prepending with
54
  * "$" (like $Foo.Bar), strings by wrapping with single or double quotes ('Foo' or "Foo")
55
  * 
56
  * Bare: The opposite of marked. An argument that has to has it's type inferred by usage and 2.4 defaults.
57
  * 
58
  * Example of using a bare argument for a loop block: <% loop Foo %>
59
  * 
60
  * Block: One of two SS template structures. The special characters "<%" and "%>" are used to wrap the opening and
61
  * (required or forbidden depending on which block exactly) closing block marks.
62
  * 
63
  * Open Block: An SS template block that doesn't wrap any content or have a closing end tag (in fact, a closing end
64
  * tag is forbidden)
65
  * 
66
  * Closed Block: An SS template block that wraps content, and requires a counterpart <% end_blockname %> tag
67
  * 
68
  * Angle Bracket: angle brackets "<" and ">" are used to eat whitespace between template elements
69
  * N: eats white space including newlines (using in legacy _t support)
70
  *
71
  * @package framework
72
  * @subpackage view
73
  */
74
class SSTemplateParser extends Parser implements TemplateParser {
75
76
	/**
77
	 * @var bool - Set true by SSTemplateParser::compileString if the template should include comments intended
78
	 * for debugging (template source, included files, etc)
79
	 */
80
	protected $includeDebuggingComments = false;
81
82
	/**
83
	 * Stores the user-supplied closed block extension rules in the form:
84
	 * array(
85
	 *   'name' => function (&$res) {}
86
	 * )
87
	 * See SSTemplateParser::ClosedBlock_Handle_Loop for an example of what the callable should look like
88
	 * @var array
89
	 */
90
	protected $closedBlocks = array();
91
92
	/**
93
	 * Stores the user-supplied open block extension rules in the form:
94
	 * array(
95
	 *   'name' => function (&$res) {}
96
	 * )
97
	 * See SSTemplateParser::OpenBlock_Handle_Base_tag for an example of what the callable should look like
98
	 * @var array
99
	 */
100
	protected $openBlocks = array();
101
102
	/**
103
	 * Allow the injection of new closed & open block callables
104
	 * @param array $closedBlocks
105
	 * @param array $openBlocks
106
	 */
107
	public function __construct($closedBlocks = array(), $openBlocks = array()) {
108
		$this->setClosedBlocks($closedBlocks);
109
		$this->setOpenBlocks($openBlocks);
110
	}
111
112
	/**
113
	 * Override the function that constructs the result arrays to also prepare a 'php' item in the array
114
	 */
115
	function construct($matchrule, $name, $arguments = null) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
116
		$res = parent::construct($matchrule, $name, $arguments);
117
		if (!isset($res['php'])) $res['php'] = '';
118
		return $res;
119
	}
120
121
	/**
122
	 * Set the closed blocks that the template parser should use
123
	 * 
124
	 * This method will delete any existing closed blocks, please use addClosedBlock if you don't
125
	 * want to overwrite
126
	 * @param array $closedBlocks
127
	 * @throws InvalidArgumentException
128
	 */
129
	public function setClosedBlocks($closedBlocks) {
130
		$this->closedBlocks = array();
131
		foreach ((array) $closedBlocks as $name => $callable) {
132
			$this->addClosedBlock($name, $callable);
133
		}
134
	}
135
136
	/**
137
	 * Set the open blocks that the template parser should use
138
	 *
139
	 * This method will delete any existing open blocks, please use addOpenBlock if you don't
140
	 * want to overwrite
141
	 * @param array $openBlocks
142
	 * @throws InvalidArgumentException
143
	 */
144
	public function setOpenBlocks($openBlocks) {
145
		$this->openBlocks = array();
146
		foreach ((array) $openBlocks as $name => $callable) {
147
			$this->addOpenBlock($name, $callable);
148
		}
149
	}
150
151
	/**
152
	 * Add a closed block callable to allow <% name %><% end_name %> syntax
153
	 * @param string $name The name of the token to be used in the syntax <% name %><% end_name %>
154
	 * @param callable $callable The function that modifies the generation of template code
155
	 * @throws InvalidArgumentException
156
	 */
157
	public function addClosedBlock($name, $callable) {
158
		$this->validateExtensionBlock($name, $callable, 'Closed block');
159
		$this->closedBlocks[$name] = $callable;
160
	}
161
162
	/**
163
	 * Add a closed block callable to allow <% name %> syntax
164
	 * @param string $name The name of the token to be used in the syntax <% name %>
165
	 * @param callable $callable The function that modifies the generation of template code
166
	 * @throws InvalidArgumentException
167
	 */
168
	public function addOpenBlock($name, $callable) {
169
		$this->validateExtensionBlock($name, $callable, 'Open block');
170
		$this->openBlocks[$name] = $callable;
171
	}
172
173
	/**
174
	 * Ensures that the arguments to addOpenBlock and addClosedBlock are valid
175
	 * @param $name
176
	 * @param $callable
177
	 * @param $type
178
	 * @throws InvalidArgumentException
179
	 */
180 View Code Duplication
	protected function validateExtensionBlock($name, $callable, $type) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
181
		if (!is_string($name)) {
182
			throw new InvalidArgumentException(
183
				sprintf(
184
					"Name argument for %s must be a string",
185
					$type
186
				)
187
			);
188
		} elseif (!is_callable($callable)) {
189
			throw new InvalidArgumentException(
190
				sprintf(
191
					"Callable %s argument named '%s' is not callable",
192
					$type,
193
					$name
194
				)
195
			);
196
		}
197
	}
198
	
199
	/* Template: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock |
200
	OpenBlock | MalformedBlock | Injection | Text)+ */
201
	protected $match_Template_typestack = array('Template');
202 View Code Duplication
	function match_Template ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
203
		$matchrule = "Template"; $result = $this->construct($matchrule, $matchrule, null);
204
		$count = 0;
205
		while (true) {
206
			$res_50 = $result;
207
			$pos_50 = $this->pos;
208
			$_49 = NULL;
0 ignored issues
show
Unused Code introduced by
$_49 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
209
			do {
0 ignored issues
show
Unused Code introduced by
do { $_47 = NULL; ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
210
				$_47 = NULL;
0 ignored issues
show
Unused Code introduced by
$_47 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
211
				do {
212
					$res_0 = $result;
213
					$pos_0 = $this->pos;
214
					$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
215
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
216
					if ($subres !== FALSE) {
217
						$this->store( $result, $subres );
218
						$_47 = TRUE; break;
219
					}
220
					$result = $res_0;
221
					$this->pos = $pos_0;
222
					$_45 = NULL;
0 ignored issues
show
Unused Code introduced by
$_45 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
223
					do {
224
						$res_2 = $result;
225
						$pos_2 = $this->pos;
226
						$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
227
						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
228
						if ($subres !== FALSE) {
229
							$this->store( $result, $subres );
230
							$_45 = TRUE; break;
231
						}
232
						$result = $res_2;
233
						$this->pos = $pos_2;
234
						$_43 = NULL;
0 ignored issues
show
Unused Code introduced by
$_43 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
235
						do {
236
							$res_4 = $result;
237
							$pos_4 = $this->pos;
238
							$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
239
							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
240
							if ($subres !== FALSE) {
241
								$this->store( $result, $subres );
242
								$_43 = TRUE; break;
243
							}
244
							$result = $res_4;
245
							$this->pos = $pos_4;
246
							$_41 = NULL;
0 ignored issues
show
Unused Code introduced by
$_41 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
247
							do {
248
								$res_6 = $result;
249
								$pos_6 = $this->pos;
250
								$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
251
								$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
252
								if ($subres !== FALSE) {
253
									$this->store( $result, $subres );
254
									$_41 = TRUE; break;
255
								}
256
								$result = $res_6;
257
								$this->pos = $pos_6;
258
								$_39 = NULL;
0 ignored issues
show
Unused Code introduced by
$_39 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
259
								do {
260
									$res_8 = $result;
261
									$pos_8 = $this->pos;
262
									$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
263
									$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
264
									if ($subres !== FALSE) {
265
										$this->store( $result, $subres );
266
										$_39 = TRUE; break;
267
									}
268
									$result = $res_8;
269
									$this->pos = $pos_8;
270
									$_37 = NULL;
0 ignored issues
show
Unused Code introduced by
$_37 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
271
									do {
272
										$res_10 = $result;
273
										$pos_10 = $this->pos;
274
										$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
275
										$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
276
										if ($subres !== FALSE) {
277
											$this->store( $result, $subres );
278
											$_37 = TRUE; break;
279
										}
280
										$result = $res_10;
281
										$this->pos = $pos_10;
282
										$_35 = NULL;
0 ignored issues
show
Unused Code introduced by
$_35 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
283
										do {
284
											$res_12 = $result;
285
											$pos_12 = $this->pos;
286
											$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
287
											$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
288
											if ($subres !== FALSE) {
289
												$this->store( $result, $subres );
290
												$_35 = TRUE; break;
291
											}
292
											$result = $res_12;
293
											$this->pos = $pos_12;
294
											$_33 = NULL;
0 ignored issues
show
Unused Code introduced by
$_33 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
295
											do {
296
												$res_14 = $result;
297
												$pos_14 = $this->pos;
298
												$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
299
												$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
300
												if ($subres !== FALSE) {
301
													$this->store( $result, $subres );
302
													$_33 = TRUE; break;
303
												}
304
												$result = $res_14;
305
												$this->pos = $pos_14;
306
												$_31 = NULL;
0 ignored issues
show
Unused Code introduced by
$_31 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
307
												do {
308
													$res_16 = $result;
309
													$pos_16 = $this->pos;
310
													$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
311
													$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
312
													if ($subres !== FALSE) {
313
														$this->store( $result, $subres );
314
														$_31 = TRUE; break;
315
													}
316
													$result = $res_16;
317
													$this->pos = $pos_16;
318
													$_29 = NULL;
0 ignored issues
show
Unused Code introduced by
$_29 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
319
													do {
320
														$res_18 = $result;
321
														$pos_18 = $this->pos;
322
														$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
323
														$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
324
														if ($subres !== FALSE) {
325
															$this->store( $result, $subres );
326
															$_29 = TRUE; break;
327
														}
328
														$result = $res_18;
329
														$this->pos = $pos_18;
330
														$_27 = NULL;
0 ignored issues
show
Unused Code introduced by
$_27 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
331
														do {
332
															$res_20 = $result;
333
															$pos_20 = $this->pos;
334
															$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
335
															$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
336
															if ($subres !== FALSE) {
337
																$this->store( $result, $subres );
338
																$_27 = TRUE; break;
339
															}
340
															$result = $res_20;
341
															$this->pos = $pos_20;
342
															$_25 = NULL;
0 ignored issues
show
Unused Code introduced by
$_25 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
343
															do {
344
																$res_22 = $result;
345
																$pos_22 = $this->pos;
346
																$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
347
																$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
348
																if ($subres !== FALSE) {
349
																	$this->store( $result, $subres );
350
																	$_25 = TRUE; break;
351
																}
352
																$result = $res_22;
353
																$this->pos = $pos_22;
354
																$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
355
																$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
356
																if ($subres !== FALSE) {
357
																	$this->store( $result, $subres );
358
																	$_25 = TRUE; break;
359
																}
360
																$result = $res_22;
361
																$this->pos = $pos_22;
362
																$_25 = FALSE; break;
363
															}
364
															while(0);
365
															if( $_25 === TRUE ) { $_27 = TRUE; break; }
366
															$result = $res_20;
367
															$this->pos = $pos_20;
368
															$_27 = FALSE; break;
369
														}
370
														while(0);
371
														if( $_27 === TRUE ) { $_29 = TRUE; break; }
372
														$result = $res_18;
373
														$this->pos = $pos_18;
374
														$_29 = FALSE; break;
375
													}
376
													while(0);
377
													if( $_29 === TRUE ) { $_31 = TRUE; break; }
378
													$result = $res_16;
379
													$this->pos = $pos_16;
380
													$_31 = FALSE; break;
381
												}
382
												while(0);
383
												if( $_31 === TRUE ) { $_33 = TRUE; break; }
384
												$result = $res_14;
385
												$this->pos = $pos_14;
386
												$_33 = FALSE; break;
387
											}
388
											while(0);
389
											if( $_33 === TRUE ) { $_35 = TRUE; break; }
390
											$result = $res_12;
391
											$this->pos = $pos_12;
392
											$_35 = FALSE; break;
393
										}
394
										while(0);
395
										if( $_35 === TRUE ) { $_37 = TRUE; break; }
396
										$result = $res_10;
397
										$this->pos = $pos_10;
398
										$_37 = FALSE; break;
399
									}
400
									while(0);
401
									if( $_37 === TRUE ) { $_39 = TRUE; break; }
402
									$result = $res_8;
403
									$this->pos = $pos_8;
404
									$_39 = FALSE; break;
405
								}
406
								while(0);
407
								if( $_39 === TRUE ) { $_41 = TRUE; break; }
408
								$result = $res_6;
409
								$this->pos = $pos_6;
410
								$_41 = FALSE; break;
411
							}
412
							while(0);
413
							if( $_41 === TRUE ) { $_43 = TRUE; break; }
414
							$result = $res_4;
415
							$this->pos = $pos_4;
416
							$_43 = FALSE; break;
417
						}
418
						while(0);
419
						if( $_43 === TRUE ) { $_45 = TRUE; break; }
420
						$result = $res_2;
421
						$this->pos = $pos_2;
422
						$_45 = FALSE; break;
423
					}
424
					while(0);
425
					if( $_45 === TRUE ) { $_47 = TRUE; break; }
426
					$result = $res_0;
427
					$this->pos = $pos_0;
428
					$_47 = FALSE; break;
429
				}
430
				while(0);
431
				if( $_47 === FALSE) { $_49 = FALSE; break; }
432
				$_49 = TRUE; break;
433
			}
434
			while(0);
435
			if( $_49 === FALSE) {
436
				$result = $res_50;
437
				$this->pos = $pos_50;
438
				unset( $res_50 );
439
				unset( $pos_50 );
440
				break;
441
			}
442
			$count += 1;
443
		}
444
		if ($count > 0) { return $this->finalise($result); }
445
		else { return FALSE; }
446
	}
447
448
449
450
	function Template_STR(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
451
		$res['php'] .= $sub['php'] . PHP_EOL ;
452
	}
453
	
454
	/* Word: / [A-Za-z_] [A-Za-z0-9_]* / */
455
	protected $match_Word_typestack = array('Word');
456 View Code Duplication
	function match_Word ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
457
		$matchrule = "Word"; $result = $this->construct($matchrule, $matchrule, null);
458
		if (( $subres = $this->rx( '/ [A-Za-z_] [A-Za-z0-9_]* /' ) ) !== FALSE) {
459
			$result["text"] .= $subres;
460
			return $this->finalise($result);
461
		}
462
		else { return FALSE; }
463
	}
464
465
466
	/* NamespacedWord: / [A-Za-z_\/\\] [A-Za-z0-9_\/\\]* / */
467
	protected $match_NamespacedWord_typestack = array('NamespacedWord');
468
	function match_NamespacedWord ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
469
		$matchrule = "NamespacedWord"; $result = $this->construct($matchrule, $matchrule, null);
470
		if (( $subres = $this->rx( '/ [A-Za-z_\/\\\\] [A-Za-z0-9_\/\\\\]* /' ) ) !== FALSE) {
471
			$result["text"] .= $subres;
472
			return $this->finalise($result);
473
		}
474
		else { return FALSE; }
475
	}
476
477
478
	/* Number: / [0-9]+ / */
479
	protected $match_Number_typestack = array('Number');
480 View Code Duplication
	function match_Number ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
481
		$matchrule = "Number"; $result = $this->construct($matchrule, $matchrule, null);
482
		if (( $subres = $this->rx( '/ [0-9]+ /' ) ) !== FALSE) {
483
			$result["text"] .= $subres;
484
			return $this->finalise($result);
485
		}
486
		else { return FALSE; }
487
	}
488
489
490
	/* Value: / [A-Za-z0-9_]+ / */
491
	protected $match_Value_typestack = array('Value');
492 View Code Duplication
	function match_Value ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
493
		$matchrule = "Value"; $result = $this->construct($matchrule, $matchrule, null);
494
		if (( $subres = $this->rx( '/ [A-Za-z0-9_]+ /' ) ) !== FALSE) {
495
			$result["text"] .= $subres;
496
			return $this->finalise($result);
497
		}
498
		else { return FALSE; }
499
	}
500
501
502
	/* CallArguments: :Argument ( < "," < :Argument )* */
503
	protected $match_CallArguments_typestack = array('CallArguments');
504 View Code Duplication
	function match_CallArguments ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
505
		$matchrule = "CallArguments"; $result = $this->construct($matchrule, $matchrule, null);
506
		$_62 = NULL;
0 ignored issues
show
Unused Code introduced by
$_62 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
507
		do {
0 ignored issues
show
Unused Code introduced by
do { $matcher = 'mat... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
508
			$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
509
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
510
			if ($subres !== FALSE) {
511
				$this->store( $result, $subres, "Argument" );
512
			}
513
			else { $_62 = FALSE; break; }
514
			while (true) {
515
				$res_61 = $result;
516
				$pos_61 = $this->pos;
517
				$_60 = NULL;
0 ignored issues
show
Unused Code introduced by
$_60 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
518
				do {
519
					if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
520
					if (substr($this->string,$this->pos,1) == ',') {
521
						$this->pos += 1;
522
						$result["text"] .= ',';
523
					}
524
					else { $_60 = FALSE; break; }
525
					if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
526
					$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
527
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
528
					if ($subres !== FALSE) {
529
						$this->store( $result, $subres, "Argument" );
530
					}
531
					else { $_60 = FALSE; break; }
532
					$_60 = TRUE; break;
533
				}
534
				while(0);
535
				if( $_60 === FALSE) {
536
					$result = $res_61;
537
					$this->pos = $pos_61;
538
					unset( $res_61 );
539
					unset( $pos_61 );
540
					break;
541
				}
542
			}
543
			$_62 = TRUE; break;
544
		}
545
		while(0);
546
		if( $_62 === TRUE ) { return $this->finalise($result); }
547
		if( $_62 === FALSE) { return FALSE; }
548
	}
549
550
551
552
553
	/** 
554
	 * Values are bare words in templates, but strings in PHP. We rely on PHP's type conversion to back-convert
555
	 * strings to numbers when needed.
556
	 */
557
	function CallArguments_Argument(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
558
		if (!empty($res['php'])) $res['php'] .= ', ';
559
		
560
		$res['php'] .= ($sub['ArgumentMode'] == 'default') ? $sub['string_php'] : 
561
			str_replace('$$FINAL', 'XML_val', $sub['php']);
562
	}
563
564
	/* Call: Method:Word ( "(" < :CallArguments? > ")" )? */
565
	protected $match_Call_typestack = array('Call');
566
	function match_Call ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
567
		$matchrule = "Call"; $result = $this->construct($matchrule, $matchrule, null);
568
		$_72 = NULL;
0 ignored issues
show
Unused Code introduced by
$_72 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
569
		do {
0 ignored issues
show
Unused Code introduced by
do { $matcher = 'mat... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
570
			$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
571
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
572
			if ($subres !== FALSE) {
573
				$this->store( $result, $subres, "Method" );
574
			}
575
			else { $_72 = FALSE; break; }
576
			$res_71 = $result;
577
			$pos_71 = $this->pos;
578
			$_70 = NULL;
0 ignored issues
show
Unused Code introduced by
$_70 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
579
			do {
580
				if (substr($this->string,$this->pos,1) == '(') {
581
					$this->pos += 1;
582
					$result["text"] .= '(';
583
				}
584
				else { $_70 = FALSE; break; }
585
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
586
				$res_67 = $result;
587
				$pos_67 = $this->pos;
588
				$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
589
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
590
				if ($subres !== FALSE) {
591
					$this->store( $result, $subres, "CallArguments" );
592
				}
593
				else {
594
					$result = $res_67;
595
					$this->pos = $pos_67;
596
					unset( $res_67 );
597
					unset( $pos_67 );
598
				}
599
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
600
				if (substr($this->string,$this->pos,1) == ')') {
601
					$this->pos += 1;
602
					$result["text"] .= ')';
603
				}
604
				else { $_70 = FALSE; break; }
605
				$_70 = TRUE; break;
606
			}
607
			while(0);
608
			if( $_70 === FALSE) {
609
				$result = $res_71;
610
				$this->pos = $pos_71;
611
				unset( $res_71 );
612
				unset( $pos_71 );
613
			}
614
			$_72 = TRUE; break;
615
		}
616
		while(0);
617
		if( $_72 === TRUE ) { return $this->finalise($result); }
618
		if( $_72 === FALSE) { return FALSE; }
619
	}
620
621
622
	/* LookupStep: :Call &"." */
623
	protected $match_LookupStep_typestack = array('LookupStep');
624
	function match_LookupStep ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
625
		$matchrule = "LookupStep"; $result = $this->construct($matchrule, $matchrule, null);
626
		$_76 = NULL;
0 ignored issues
show
Unused Code introduced by
$_76 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
627
		do {
0 ignored issues
show
Unused Code introduced by
do { $matcher = 'mat... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
628
			$matcher = 'match_'.'Call'; $key = $matcher; $pos = $this->pos;
629
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
630
			if ($subres !== FALSE) {
631
				$this->store( $result, $subres, "Call" );
632
			}
633
			else { $_76 = FALSE; break; }
634
			$res_75 = $result;
635
			$pos_75 = $this->pos;
636
			if (substr($this->string,$this->pos,1) == '.') {
637
				$this->pos += 1;
638
				$result["text"] .= '.';
639
				$result = $res_75;
640
				$this->pos = $pos_75;
641
			}
642
			else {
643
				$result = $res_75;
644
				$this->pos = $pos_75;
645
				$_76 = FALSE; break;
646
			}
647
			$_76 = TRUE; break;
648
		}
649
		while(0);
650
		if( $_76 === TRUE ) { return $this->finalise($result); }
651
		if( $_76 === FALSE) { return FALSE; }
652
	}
653
654
655
	/* LastLookupStep: :Call */
656
	protected $match_LastLookupStep_typestack = array('LastLookupStep');
657 View Code Duplication
	function match_LastLookupStep ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
658
		$matchrule = "LastLookupStep"; $result = $this->construct($matchrule, $matchrule, null);
659
		$matcher = 'match_'.'Call'; $key = $matcher; $pos = $this->pos;
660
		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
661
		if ($subres !== FALSE) {
662
			$this->store( $result, $subres, "Call" );
663
			return $this->finalise($result);
664
		}
665
		else { return FALSE; }
666
	}
667
668
669
	/* Lookup: LookupStep ("." LookupStep)* "." LastLookupStep | LastLookupStep */
670
	protected $match_Lookup_typestack = array('Lookup');
671
	function match_Lookup ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
672
		$matchrule = "Lookup"; $result = $this->construct($matchrule, $matchrule, null);
673
		$_90 = NULL;
0 ignored issues
show
Unused Code introduced by
$_90 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
674
		do {
0 ignored issues
show
Unused Code introduced by
do { $res_79 = $resu... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
675
			$res_79 = $result;
676
			$pos_79 = $this->pos;
677
			$_87 = NULL;
0 ignored issues
show
Unused Code introduced by
$_87 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
678
			do {
679
				$matcher = 'match_'.'LookupStep'; $key = $matcher; $pos = $this->pos;
680
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
681
				if ($subres !== FALSE) { $this->store( $result, $subres ); }
682
				else { $_87 = FALSE; break; }
683
				while (true) {
684
					$res_84 = $result;
685
					$pos_84 = $this->pos;
686
					$_83 = NULL;
0 ignored issues
show
Unused Code introduced by
$_83 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
687 View Code Duplication
					do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
688
						if (substr($this->string,$this->pos,1) == '.') {
689
							$this->pos += 1;
690
							$result["text"] .= '.';
691
						}
692
						else { $_83 = FALSE; break; }
693
						$matcher = 'match_'.'LookupStep'; $key = $matcher; $pos = $this->pos;
694
						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
695
						if ($subres !== FALSE) {
696
							$this->store( $result, $subres );
697
						}
698
						else { $_83 = FALSE; break; }
699
						$_83 = TRUE; break;
700
					}
701
					while(0);
702
					if( $_83 === FALSE) {
703
						$result = $res_84;
704
						$this->pos = $pos_84;
705
						unset( $res_84 );
706
						unset( $pos_84 );
707
						break;
708
					}
709
				}
710
				if (substr($this->string,$this->pos,1) == '.') {
711
					$this->pos += 1;
712
					$result["text"] .= '.';
713
				}
714
				else { $_87 = FALSE; break; }
715
				$matcher = 'match_'.'LastLookupStep'; $key = $matcher; $pos = $this->pos;
716
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
717
				if ($subres !== FALSE) { $this->store( $result, $subres ); }
718
				else { $_87 = FALSE; break; }
719
				$_87 = TRUE; break;
720
			}
721
			while(0);
722
			if( $_87 === TRUE ) { $_90 = TRUE; break; }
723
			$result = $res_79;
724
			$this->pos = $pos_79;
725
			$matcher = 'match_'.'LastLookupStep'; $key = $matcher; $pos = $this->pos;
726
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
727
			if ($subres !== FALSE) {
728
				$this->store( $result, $subres );
729
				$_90 = TRUE; break;
730
			}
731
			$result = $res_79;
732
			$this->pos = $pos_79;
733
			$_90 = FALSE; break;
734
		}
735
		while(0);
736
		if( $_90 === TRUE ) { return $this->finalise($result); }
737
		if( $_90 === FALSE) { return FALSE; }
738
	}
739
740
741
742
	
743
	function Lookup__construct(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
744
		$res['php'] = '$scope->locally()';
745
		$res['LookupSteps'] = array();
746
	}
747
	
748
	/** 
749
	 * The basic generated PHP of LookupStep and LastLookupStep is the same, except that LookupStep calls 'obj' to 
750
	 * get the next ViewableData in the sequence, and LastLookupStep calls different methods (XML_val, hasValue, obj)
751
	 * depending on the context the lookup is used in.
752
	 */
753 View Code Duplication
	function Lookup_AddLookupStep(&$res, $sub, $method) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
754
		$res['LookupSteps'][] = $sub;
755
		
756
		$property = $sub['Call']['Method']['text'];
757
		
758
		if (isset($sub['Call']['CallArguments']) && $arguments = $sub['Call']['CallArguments']['php']) {
759
			$res['php'] .= "->$method('$property', array($arguments), true)";
760
		}
761
		else {
762
			$res['php'] .= "->$method('$property', null, true)";
763
		}
764
	}
765
766
	function Lookup_LookupStep(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
767
		$this->Lookup_AddLookupStep($res, $sub, 'obj');
768
	}
769
770
	function Lookup_LastLookupStep(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
771
		$this->Lookup_AddLookupStep($res, $sub, '$$FINAL');
772
	}
773
774
775
	/* Translate: "<%t" < Entity < (Default:QuotedString)? < (!("is" "=") < "is" < Context:QuotedString)? <
776
	(InjectionVariables)? > "%>" */
777
	protected $match_Translate_typestack = array('Translate');
778
	function match_Translate ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
779
		$matchrule = "Translate"; $result = $this->construct($matchrule, $matchrule, null);
780
		$_116 = NULL;
0 ignored issues
show
Unused Code introduced by
$_116 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
781
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
782
			if (( $subres = $this->literal( '<%t' ) ) !== FALSE) { $result["text"] .= $subres; }
783
			else { $_116 = FALSE; break; }
784
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
785
			$matcher = 'match_'.'Entity'; $key = $matcher; $pos = $this->pos;
786
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
787
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
788
			else { $_116 = FALSE; break; }
789
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
790
			$res_98 = $result;
791
			$pos_98 = $this->pos;
792
			$_97 = NULL;
0 ignored issues
show
Unused Code introduced by
$_97 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
793 View Code Duplication
			do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
794
				$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
795
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
796
				if ($subres !== FALSE) {
797
					$this->store( $result, $subres, "Default" );
798
				}
799
				else { $_97 = FALSE; break; }
800
				$_97 = TRUE; break;
801
			}
802
			while(0);
803
			if( $_97 === FALSE) {
804
				$result = $res_98;
805
				$this->pos = $pos_98;
806
				unset( $res_98 );
807
				unset( $pos_98 );
808
			}
809
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
810
			$res_109 = $result;
811
			$pos_109 = $this->pos;
812
			$_108 = NULL;
0 ignored issues
show
Unused Code introduced by
$_108 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
813
			do {
814
				$res_103 = $result;
815
				$pos_103 = $this->pos;
816
				$_102 = NULL;
0 ignored issues
show
Unused Code introduced by
$_102 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
817
				do {
818
					if (( $subres = $this->literal( 'is' ) ) !== FALSE) { $result["text"] .= $subres; }
819
					else { $_102 = FALSE; break; }
820
					if (substr($this->string,$this->pos,1) == '=') {
821
						$this->pos += 1;
822
						$result["text"] .= '=';
823
					}
824
					else { $_102 = FALSE; break; }
825
					$_102 = TRUE; break;
826
				}
827
				while(0);
828
				if( $_102 === TRUE ) {
829
					$result = $res_103;
830
					$this->pos = $pos_103;
831
					$_108 = FALSE; break;
832
				}
833
				if( $_102 === FALSE) {
834
					$result = $res_103;
835
					$this->pos = $pos_103;
836
				}
837
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
838
				if (( $subres = $this->literal( 'is' ) ) !== FALSE) { $result["text"] .= $subres; }
839
				else { $_108 = FALSE; break; }
840
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
841
				$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
842
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
843
				if ($subres !== FALSE) {
844
					$this->store( $result, $subres, "Context" );
845
				}
846
				else { $_108 = FALSE; break; }
847
				$_108 = TRUE; break;
848
			}
849
			while(0);
850
			if( $_108 === FALSE) {
851
				$result = $res_109;
852
				$this->pos = $pos_109;
853
				unset( $res_109 );
854
				unset( $pos_109 );
855
			}
856
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
857
			$res_113 = $result;
858
			$pos_113 = $this->pos;
859
			$_112 = NULL;
0 ignored issues
show
Unused Code introduced by
$_112 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
860 View Code Duplication
			do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
861
				$matcher = 'match_'.'InjectionVariables'; $key = $matcher; $pos = $this->pos;
862
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
863
				if ($subres !== FALSE) { $this->store( $result, $subres ); }
864
				else { $_112 = FALSE; break; }
865
				$_112 = TRUE; break;
866
			}
867
			while(0);
868
			if( $_112 === FALSE) {
869
				$result = $res_113;
870
				$this->pos = $pos_113;
871
				unset( $res_113 );
872
				unset( $pos_113 );
873
			}
874
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
875
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
876
			else { $_116 = FALSE; break; }
877
			$_116 = TRUE; break;
878
		}
879
		while(0);
880
		if( $_116 === TRUE ) { return $this->finalise($result); }
881
		if( $_116 === FALSE) { return FALSE; }
882
	}
883
884
885
	/* InjectionVariables: (< InjectionName:Word "=" Argument)+ */
886
	protected $match_InjectionVariables_typestack = array('InjectionVariables');
887
	function match_InjectionVariables ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
888
		$matchrule = "InjectionVariables"; $result = $this->construct($matchrule, $matchrule, null);
889
		$count = 0;
890
		while (true) {
891
			$res_123 = $result;
892
			$pos_123 = $this->pos;
893
			$_122 = NULL;
0 ignored issues
show
Unused Code introduced by
$_122 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
894
			do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
895
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
896
				$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
897
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
898
				if ($subres !== FALSE) {
899
					$this->store( $result, $subres, "InjectionName" );
900
				}
901
				else { $_122 = FALSE; break; }
902
				if (substr($this->string,$this->pos,1) == '=') {
903
					$this->pos += 1;
904
					$result["text"] .= '=';
905
				}
906
				else { $_122 = FALSE; break; }
907
				$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
908
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
909
				if ($subres !== FALSE) { $this->store( $result, $subres ); }
910
				else { $_122 = FALSE; break; }
911
				$_122 = TRUE; break;
912
			}
913
			while(0);
914
			if( $_122 === FALSE) {
915
				$result = $res_123;
916
				$this->pos = $pos_123;
917
				unset( $res_123 );
918
				unset( $pos_123 );
919
				break;
920
			}
921
			$count += 1;
922
		}
923
		if ($count > 0) { return $this->finalise($result); }
924
		else { return FALSE; }
925
	}
926
927
928
	/* Entity: / [A-Za-z_] [\w\.]* / */
929
	protected $match_Entity_typestack = array('Entity');
930 View Code Duplication
	function match_Entity ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
931
		$matchrule = "Entity"; $result = $this->construct($matchrule, $matchrule, null);
932
		if (( $subres = $this->rx( '/ [A-Za-z_] [\w\.]* /' ) ) !== FALSE) {
933
			$result["text"] .= $subres;
934
			return $this->finalise($result);
935
		}
936
		else { return FALSE; }
937
	}
938
939
940
941
942
	function Translate__construct(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
943
		$res['php'] = '$val .= _t(';
944
	}
945
946
	function Translate_Entity(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
947
		$res['php'] .= "'$sub[text]'";
948
	}
949
950
	function Translate_Default(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
951
		$res['php'] .= ",$sub[text]";
952
	}
953
954
	function Translate_Context(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
955
		$res['php'] .= ",$sub[text]";
956
	}
957
958
	function Translate_InjectionVariables(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
959
		$res['php'] .= ",$sub[php]";
960
	}
961
962
	function Translate__finalise(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
963
		$res['php'] .= ');';
964
	}
965
966
	function InjectionVariables__construct(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
967
		$res['php'] = "array(";
968
	}
969
970
	function InjectionVariables_InjectionName(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
971
		$res['php'] .= "'$sub[text]'=>";
972
	}
973
974
	function InjectionVariables_Argument(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
975
		$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']) . ',';
976
	}
977
978
	function InjectionVariables__finalise(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
979 View Code Duplication
		if (substr($res['php'], -1) == ',') $res['php'] = substr($res['php'], 0, -1); //remove last comma in the array
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
980
		$res['php'] .= ')';
981
	}
982
983
984
	/* SimpleInjection: '$' :Lookup */
985
	protected $match_SimpleInjection_typestack = array('SimpleInjection');
986
	function match_SimpleInjection ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
987
		$matchrule = "SimpleInjection"; $result = $this->construct($matchrule, $matchrule, null);
988
		$_127 = NULL;
0 ignored issues
show
Unused Code introduced by
$_127 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
989 View Code Duplication
		do {
0 ignored issues
show
Unused Code introduced by
do { if (substr($thi... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
990
			if (substr($this->string,$this->pos,1) == '$') {
991
				$this->pos += 1;
992
				$result["text"] .= '$';
993
			}
994
			else { $_127 = FALSE; break; }
995
			$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
996
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
997
			if ($subres !== FALSE) {
998
				$this->store( $result, $subres, "Lookup" );
999
			}
1000
			else { $_127 = FALSE; break; }
1001
			$_127 = TRUE; break;
1002
		}
1003
		while(0);
1004
		if( $_127 === TRUE ) { return $this->finalise($result); }
1005
		if( $_127 === FALSE) { return FALSE; }
1006
	}
1007
1008
1009
	/* BracketInjection: '{$' :Lookup "}" */
1010
	protected $match_BracketInjection_typestack = array('BracketInjection');
1011
	function match_BracketInjection ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1012
		$matchrule = "BracketInjection"; $result = $this->construct($matchrule, $matchrule, null);
1013
		$_132 = NULL;
0 ignored issues
show
Unused Code introduced by
$_132 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1014
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1015
			if (( $subres = $this->literal( '{$' ) ) !== FALSE) { $result["text"] .= $subres; }
1016
			else { $_132 = FALSE; break; }
1017
			$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
1018
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1019
			if ($subres !== FALSE) {
1020
				$this->store( $result, $subres, "Lookup" );
1021
			}
1022
			else { $_132 = FALSE; break; }
1023
			if (substr($this->string,$this->pos,1) == '}') {
1024
				$this->pos += 1;
1025
				$result["text"] .= '}';
1026
			}
1027
			else { $_132 = FALSE; break; }
1028
			$_132 = TRUE; break;
1029
		}
1030
		while(0);
1031
		if( $_132 === TRUE ) { return $this->finalise($result); }
1032
		if( $_132 === FALSE) { return FALSE; }
1033
	}
1034
1035
1036
	/* Injection: BracketInjection | SimpleInjection */
1037
	protected $match_Injection_typestack = array('Injection');
1038 View Code Duplication
	function match_Injection ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1039
		$matchrule = "Injection"; $result = $this->construct($matchrule, $matchrule, null);
1040
		$_137 = NULL;
0 ignored issues
show
Unused Code introduced by
$_137 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1041
		do {
0 ignored issues
show
Unused Code introduced by
do { $res_134 = $res... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1042
			$res_134 = $result;
1043
			$pos_134 = $this->pos;
1044
			$matcher = 'match_'.'BracketInjection'; $key = $matcher; $pos = $this->pos;
1045
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1046
			if ($subres !== FALSE) {
1047
				$this->store( $result, $subres );
1048
				$_137 = TRUE; break;
1049
			}
1050
			$result = $res_134;
1051
			$this->pos = $pos_134;
1052
			$matcher = 'match_'.'SimpleInjection'; $key = $matcher; $pos = $this->pos;
1053
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1054
			if ($subres !== FALSE) {
1055
				$this->store( $result, $subres );
1056
				$_137 = TRUE; break;
1057
			}
1058
			$result = $res_134;
1059
			$this->pos = $pos_134;
1060
			$_137 = FALSE; break;
1061
		}
1062
		while(0);
1063
		if( $_137 === TRUE ) { return $this->finalise($result); }
1064
		if( $_137 === FALSE) { return FALSE; }
1065
	}
1066
1067
1068
1069
	function Injection_STR(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1070
		$res['php'] = '$val .= '. str_replace('$$FINAL', 'XML_val', $sub['Lookup']['php']) . ';';
1071
	}
1072
1073
	/* DollarMarkedLookup: SimpleInjection */
1074
	protected $match_DollarMarkedLookup_typestack = array('DollarMarkedLookup');
1075 View Code Duplication
	function match_DollarMarkedLookup ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1076
		$matchrule = "DollarMarkedLookup"; $result = $this->construct($matchrule, $matchrule, null);
1077
		$matcher = 'match_'.'SimpleInjection'; $key = $matcher; $pos = $this->pos;
1078
		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1079
		if ($subres !== FALSE) {
1080
			$this->store( $result, $subres );
1081
			return $this->finalise($result);
1082
		}
1083
		else { return FALSE; }
1084
	}
1085
1086
1087
1088
	function DollarMarkedLookup_STR(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1089
		$res['Lookup'] = $sub['Lookup'];
1090
	}
1091
1092
	/* QuotedString: q:/['"]/   String:/ (\\\\ | \\. | [^$q\\])* /   '$q' */
1093
	protected $match_QuotedString_typestack = array('QuotedString');
1094
	function match_QuotedString ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1095
		$matchrule = "QuotedString"; $result = $this->construct($matchrule, $matchrule, null);
1096
		$_143 = NULL;
0 ignored issues
show
Unused Code introduced by
$_143 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1097
		do {
0 ignored issues
show
Unused Code introduced by
do { $stack[] = $res... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1098
			$stack[] = $result; $result = $this->construct( $matchrule, "q" ); 
1099 View Code Duplication
			if (( $subres = $this->rx( '/[\'"]/' ) ) !== FALSE) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1100
				$result["text"] .= $subres;
1101
				$subres = $result; $result = array_pop($stack);
1102
				$this->store( $result, $subres, 'q' );
1103
			}
1104
			else {
1105
				$result = array_pop($stack);
1106
				$_143 = FALSE; break;
1107
			}
1108
			$stack[] = $result; $result = $this->construct( $matchrule, "String" ); 
1109
			if (( $subres = $this->rx( '/ (\\\\\\\\ | \\\\. | [^'.$this->expression($result, $stack, 'q').'\\\\])* /' ) ) !== FALSE) {
1110
				$result["text"] .= $subres;
1111
				$subres = $result; $result = array_pop($stack);
1112
				$this->store( $result, $subres, 'String' );
1113
			}
1114
			else {
1115
				$result = array_pop($stack);
1116
				$_143 = FALSE; break;
1117
			}
1118 View Code Duplication
			if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'q').'' ) ) !== FALSE) { $result["text"] .= $subres; }
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1119
			else { $_143 = FALSE; break; }
1120
			$_143 = TRUE; break;
1121
		}
1122
		while(0);
1123
		if( $_143 === TRUE ) { return $this->finalise($result); }
1124
		if( $_143 === FALSE) { return FALSE; }
1125
	}
1126
1127
1128
	/* FreeString: /[^,)%!=><|&]+/ */
1129
	protected $match_FreeString_typestack = array('FreeString');
1130 View Code Duplication
	function match_FreeString ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1131
		$matchrule = "FreeString"; $result = $this->construct($matchrule, $matchrule, null);
1132
		if (( $subres = $this->rx( '/[^,)%!=><|&]+/' ) ) !== FALSE) {
1133
			$result["text"] .= $subres;
1134
			return $this->finalise($result);
1135
		}
1136
		else { return FALSE; }
1137
	}
1138
1139
1140
	/* Argument:
1141
	:DollarMarkedLookup |
1142
	:QuotedString |
1143
	:Lookup !(< FreeString)|
1144
	:FreeString */
1145
	protected $match_Argument_typestack = array('Argument');
1146
	function match_Argument ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1147
		$matchrule = "Argument"; $result = $this->construct($matchrule, $matchrule, null);
1148
		$_163 = NULL;
0 ignored issues
show
Unused Code introduced by
$_163 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1149
		do {
0 ignored issues
show
Unused Code introduced by
do { $res_146 = $res... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1150
			$res_146 = $result;
1151
			$pos_146 = $this->pos;
1152
			$matcher = 'match_'.'DollarMarkedLookup'; $key = $matcher; $pos = $this->pos;
1153
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1154
			if ($subres !== FALSE) {
1155
				$this->store( $result, $subres, "DollarMarkedLookup" );
1156
				$_163 = TRUE; break;
1157
			}
1158
			$result = $res_146;
1159
			$this->pos = $pos_146;
1160
			$_161 = NULL;
0 ignored issues
show
Unused Code introduced by
$_161 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1161
			do {
1162
				$res_148 = $result;
1163
				$pos_148 = $this->pos;
1164
				$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
1165
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1166
				if ($subres !== FALSE) {
1167
					$this->store( $result, $subres, "QuotedString" );
1168
					$_161 = TRUE; break;
1169
				}
1170
				$result = $res_148;
1171
				$this->pos = $pos_148;
1172
				$_159 = NULL;
0 ignored issues
show
Unused Code introduced by
$_159 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1173
				do {
1174
					$res_150 = $result;
1175
					$pos_150 = $this->pos;
1176
					$_156 = NULL;
0 ignored issues
show
Unused Code introduced by
$_156 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1177
					do {
1178
						$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
1179
						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1180
						if ($subres !== FALSE) {
1181
							$this->store( $result, $subres, "Lookup" );
1182
						}
1183
						else { $_156 = FALSE; break; }
1184
						$res_155 = $result;
1185
						$pos_155 = $this->pos;
1186
						$_154 = NULL;
0 ignored issues
show
Unused Code introduced by
$_154 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1187
						do {
1188
							if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1189
							$matcher = 'match_'.'FreeString'; $key = $matcher; $pos = $this->pos;
1190
							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1191
							if ($subres !== FALSE) {
1192
								$this->store( $result, $subres );
1193
							}
1194
							else { $_154 = FALSE; break; }
1195
							$_154 = TRUE; break;
1196
						}
1197
						while(0);
1198
						if( $_154 === TRUE ) {
1199
							$result = $res_155;
1200
							$this->pos = $pos_155;
1201
							$_156 = FALSE; break;
1202
						}
1203
						if( $_154 === FALSE) {
1204
							$result = $res_155;
1205
							$this->pos = $pos_155;
1206
						}
1207
						$_156 = TRUE; break;
1208
					}
1209
					while(0);
1210
					if( $_156 === TRUE ) { $_159 = TRUE; break; }
1211
					$result = $res_150;
1212
					$this->pos = $pos_150;
1213
					$matcher = 'match_'.'FreeString'; $key = $matcher; $pos = $this->pos;
1214
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1215
					if ($subres !== FALSE) {
1216
						$this->store( $result, $subres, "FreeString" );
1217
						$_159 = TRUE; break;
1218
					}
1219
					$result = $res_150;
1220
					$this->pos = $pos_150;
1221
					$_159 = FALSE; break;
1222
				}
1223
				while(0);
1224
				if( $_159 === TRUE ) { $_161 = TRUE; break; }
1225
				$result = $res_148;
1226
				$this->pos = $pos_148;
1227
				$_161 = FALSE; break;
1228
			}
1229
			while(0);
1230
			if( $_161 === TRUE ) { $_163 = TRUE; break; }
1231
			$result = $res_146;
1232
			$this->pos = $pos_146;
1233
			$_163 = FALSE; break;
1234
		}
1235
		while(0);
1236
		if( $_163 === TRUE ) { return $this->finalise($result); }
1237
		if( $_163 === FALSE) { return FALSE; }
1238
	}
1239
1240
1241
1242
	
1243
	/**
1244
	 * If we get a bare value, we don't know enough to determine exactly what php would be the translation, because
1245
	 * we don't know if the position of use indicates a lookup or a string argument.
1246
	 * 
1247
	 * Instead, we record 'ArgumentMode' as a member of this matches results node, which can be:
1248
	 *   - lookup if this argument was unambiguously a lookup (marked as such)
1249
	 *   - string is this argument was unambiguously a string (marked as such, or impossible to parse as lookup)
1250
	 *   - default if this argument needs to be handled as per 2.4
1251
	 * 
1252
	 * In the case of 'default', there is no php member of the results node, but instead 'lookup_php', which
1253
	 * should be used by the parent if the context indicates a lookup, and 'string_php' which should be used
1254
	 * if the context indicates a string
1255
	 */
1256
	
1257
	function Argument_DollarMarkedLookup(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1258
		$res['ArgumentMode'] = 'lookup';
1259
		$res['php'] = $sub['Lookup']['php'];
1260
	}
1261
1262
	function Argument_QuotedString(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1263
		$res['ArgumentMode'] = 'string';
1264
		$res['php'] = "'" . str_replace("'", "\\'", $sub['String']['text']) . "'";
1265
	}
1266
1267 View Code Duplication
	function Argument_Lookup(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1268
		if (count($sub['LookupSteps']) == 1 && !isset($sub['LookupSteps'][0]['Call']['Arguments'])) {
1269
			$res['ArgumentMode'] = 'default';
1270
			$res['lookup_php'] = $sub['php'];
1271
			$res['string_php'] = "'".$sub['LookupSteps'][0]['Call']['Method']['text']."'";
1272
		}
1273
		else {
1274
			$res['ArgumentMode'] = 'lookup';
1275
			$res['php'] = $sub['php'];
1276
		}
1277
	}
1278
	
1279
	function Argument_FreeString(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1280
		$res['ArgumentMode'] = 'string';
1281
		$res['php'] = "'" . str_replace("'", "\\'", trim($sub['text'])) . "'";
1282
	}
1283
	
1284
	/* ComparisonOperator: "!=" | "==" | ">=" | ">" | "<=" | "<" | "=" */
1285
	protected $match_ComparisonOperator_typestack = array('ComparisonOperator');
1286
	function match_ComparisonOperator ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1287
		$matchrule = "ComparisonOperator"; $result = $this->construct($matchrule, $matchrule, null);
1288
		$_188 = NULL;
0 ignored issues
show
Unused Code introduced by
$_188 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1289
		do {
0 ignored issues
show
Unused Code introduced by
do { $res_165 = $res... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1290
			$res_165 = $result;
1291
			$pos_165 = $this->pos;
1292
			if (( $subres = $this->literal( '!=' ) ) !== FALSE) {
1293
				$result["text"] .= $subres;
1294
				$_188 = TRUE; break;
1295
			}
1296
			$result = $res_165;
1297
			$this->pos = $pos_165;
1298
			$_186 = NULL;
0 ignored issues
show
Unused Code introduced by
$_186 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1299
			do {
1300
				$res_167 = $result;
1301
				$pos_167 = $this->pos;
1302
				if (( $subres = $this->literal( '==' ) ) !== FALSE) {
1303
					$result["text"] .= $subres;
1304
					$_186 = TRUE; break;
1305
				}
1306
				$result = $res_167;
1307
				$this->pos = $pos_167;
1308
				$_184 = NULL;
0 ignored issues
show
Unused Code introduced by
$_184 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1309
				do {
1310
					$res_169 = $result;
1311
					$pos_169 = $this->pos;
1312
					if (( $subres = $this->literal( '>=' ) ) !== FALSE) {
1313
						$result["text"] .= $subres;
1314
						$_184 = TRUE; break;
1315
					}
1316
					$result = $res_169;
1317
					$this->pos = $pos_169;
1318
					$_182 = NULL;
0 ignored issues
show
Unused Code introduced by
$_182 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1319
					do {
1320
						$res_171 = $result;
1321
						$pos_171 = $this->pos;
1322
						if (substr($this->string,$this->pos,1) == '>') {
1323
							$this->pos += 1;
1324
							$result["text"] .= '>';
1325
							$_182 = TRUE; break;
1326
						}
1327
						$result = $res_171;
1328
						$this->pos = $pos_171;
1329
						$_180 = NULL;
0 ignored issues
show
Unused Code introduced by
$_180 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1330
						do {
1331
							$res_173 = $result;
1332
							$pos_173 = $this->pos;
1333
							if (( $subres = $this->literal( '<=' ) ) !== FALSE) {
1334
								$result["text"] .= $subres;
1335
								$_180 = TRUE; break;
1336
							}
1337
							$result = $res_173;
1338
							$this->pos = $pos_173;
1339
							$_178 = NULL;
0 ignored issues
show
Unused Code introduced by
$_178 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1340 View Code Duplication
							do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1341
								$res_175 = $result;
1342
								$pos_175 = $this->pos;
1343
								if (substr($this->string,$this->pos,1) == '<') {
1344
									$this->pos += 1;
1345
									$result["text"] .= '<';
1346
									$_178 = TRUE; break;
1347
								}
1348
								$result = $res_175;
1349
								$this->pos = $pos_175;
1350
								if (substr($this->string,$this->pos,1) == '=') {
1351
									$this->pos += 1;
1352
									$result["text"] .= '=';
1353
									$_178 = TRUE; break;
1354
								}
1355
								$result = $res_175;
1356
								$this->pos = $pos_175;
1357
								$_178 = FALSE; break;
1358
							}
1359
							while(0);
1360
							if( $_178 === TRUE ) { $_180 = TRUE; break; }
1361
							$result = $res_173;
1362
							$this->pos = $pos_173;
1363
							$_180 = FALSE; break;
1364
						}
1365
						while(0);
1366
						if( $_180 === TRUE ) { $_182 = TRUE; break; }
1367
						$result = $res_171;
1368
						$this->pos = $pos_171;
1369
						$_182 = FALSE; break;
1370
					}
1371
					while(0);
1372
					if( $_182 === TRUE ) { $_184 = TRUE; break; }
1373
					$result = $res_169;
1374
					$this->pos = $pos_169;
1375
					$_184 = FALSE; break;
1376
				}
1377
				while(0);
1378
				if( $_184 === TRUE ) { $_186 = TRUE; break; }
1379
				$result = $res_167;
1380
				$this->pos = $pos_167;
1381
				$_186 = FALSE; break;
1382
			}
1383
			while(0);
1384
			if( $_186 === TRUE ) { $_188 = TRUE; break; }
1385
			$result = $res_165;
1386
			$this->pos = $pos_165;
1387
			$_188 = FALSE; break;
1388
		}
1389
		while(0);
1390
		if( $_188 === TRUE ) { return $this->finalise($result); }
1391
		if( $_188 === FALSE) { return FALSE; }
1392
	}
1393
1394
1395
	/* Comparison: Argument < ComparisonOperator > Argument */
1396
	protected $match_Comparison_typestack = array('Comparison');
1397
	function match_Comparison ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1398
		$matchrule = "Comparison"; $result = $this->construct($matchrule, $matchrule, null);
1399
		$_195 = NULL;
0 ignored issues
show
Unused Code introduced by
$_195 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1400
		do {
0 ignored issues
show
Unused Code introduced by
do { $matcher = 'mat... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1401
			$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
1402
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1403
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
1404
			else { $_195 = FALSE; break; }
1405
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1406
			$matcher = 'match_'.'ComparisonOperator'; $key = $matcher; $pos = $this->pos;
1407
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1408
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
1409
			else { $_195 = FALSE; break; }
1410
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1411
			$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
1412
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1413
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
1414
			else { $_195 = FALSE; break; }
1415
			$_195 = TRUE; break;
1416
		}
1417
		while(0);
1418
		if( $_195 === TRUE ) { return $this->finalise($result); }
1419
		if( $_195 === FALSE) { return FALSE; }
1420
	}
1421
1422
1423
1424 View Code Duplication
	function Comparison_Argument(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1425
		if ($sub['ArgumentMode'] == 'default') {
1426
			if (!empty($res['php'])) $res['php'] .= $sub['string_php'];
1427
			else $res['php'] = str_replace('$$FINAL', 'XML_val', $sub['lookup_php']);
1428
		}	
1429
		else {
1430
			$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']);
1431
		}
1432
	}
1433
1434
	function Comparison_ComparisonOperator(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1435
		$res['php'] .= ($sub['text'] == '=' ? '==' : $sub['text']);
1436
	}
1437
1438
	/* PresenceCheck: (Not:'not' <)? Argument */
1439
	protected $match_PresenceCheck_typestack = array('PresenceCheck');
1440
	function match_PresenceCheck ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1441
		$matchrule = "PresenceCheck"; $result = $this->construct($matchrule, $matchrule, null);
1442
		$_202 = NULL;
0 ignored issues
show
Unused Code introduced by
$_202 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1443
		do {
0 ignored issues
show
Unused Code introduced by
do { $res_200 = $res... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1444
			$res_200 = $result;
1445
			$pos_200 = $this->pos;
1446
			$_199 = NULL;
0 ignored issues
show
Unused Code introduced by
$_199 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1447
			do {
1448
				$stack[] = $result; $result = $this->construct( $matchrule, "Not" ); 
1449 View Code Duplication
				if (( $subres = $this->literal( 'not' ) ) !== FALSE) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1450
					$result["text"] .= $subres;
1451
					$subres = $result; $result = array_pop($stack);
1452
					$this->store( $result, $subres, 'Not' );
1453
				}
1454
				else {
1455
					$result = array_pop($stack);
1456
					$_199 = FALSE; break;
1457
				}
1458
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1459
				$_199 = TRUE; break;
1460
			}
1461
			while(0);
1462
			if( $_199 === FALSE) {
1463
				$result = $res_200;
1464
				$this->pos = $pos_200;
1465
				unset( $res_200 );
1466
				unset( $pos_200 );
1467
			}
1468
			$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
1469
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1470
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
1471
			else { $_202 = FALSE; break; }
1472
			$_202 = TRUE; break;
1473
		}
1474
		while(0);
1475
		if( $_202 === TRUE ) { return $this->finalise($result); }
1476
		if( $_202 === FALSE) { return FALSE; }
1477
	}
1478
1479
1480
1481
	function PresenceCheck_Not(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1482
		$res['php'] = '!';
1483
	}
1484
	
1485 View Code Duplication
	function PresenceCheck_Argument(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1486
		if ($sub['ArgumentMode'] == 'string') {
1487
			$res['php'] .= '((bool)'.$sub['php'].')';
1488
		}
1489
		else {
1490
			$php = ($sub['ArgumentMode'] == 'default' ? $sub['lookup_php'] : $sub['php']);
1491
			// TODO: kinda hacky - maybe we need a way to pass state down the parse chain so
1492
			// Lookup_LastLookupStep and Argument_BareWord can produce hasValue instead of XML_val
1493
			$res['php'] .= str_replace('$$FINAL', 'hasValue', $php);
1494
		}
1495
	}
1496
1497
	/* IfArgumentPortion: Comparison | PresenceCheck */
1498
	protected $match_IfArgumentPortion_typestack = array('IfArgumentPortion');
1499 View Code Duplication
	function match_IfArgumentPortion ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1500
		$matchrule = "IfArgumentPortion"; $result = $this->construct($matchrule, $matchrule, null);
1501
		$_207 = NULL;
0 ignored issues
show
Unused Code introduced by
$_207 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1502
		do {
0 ignored issues
show
Unused Code introduced by
do { $res_204 = $res... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1503
			$res_204 = $result;
1504
			$pos_204 = $this->pos;
1505
			$matcher = 'match_'.'Comparison'; $key = $matcher; $pos = $this->pos;
1506
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1507
			if ($subres !== FALSE) {
1508
				$this->store( $result, $subres );
1509
				$_207 = TRUE; break;
1510
			}
1511
			$result = $res_204;
1512
			$this->pos = $pos_204;
1513
			$matcher = 'match_'.'PresenceCheck'; $key = $matcher; $pos = $this->pos;
1514
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1515
			if ($subres !== FALSE) {
1516
				$this->store( $result, $subres );
1517
				$_207 = TRUE; break;
1518
			}
1519
			$result = $res_204;
1520
			$this->pos = $pos_204;
1521
			$_207 = FALSE; break;
1522
		}
1523
		while(0);
1524
		if( $_207 === TRUE ) { return $this->finalise($result); }
1525
		if( $_207 === FALSE) { return FALSE; }
1526
	}
1527
1528
1529
1530
	function IfArgumentPortion_STR(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1531
		$res['php'] = $sub['php'];
1532
	}
1533
1534
	/* BooleanOperator: "||" | "&&" */
1535
	protected $match_BooleanOperator_typestack = array('BooleanOperator');
1536
	function match_BooleanOperator ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1537
		$matchrule = "BooleanOperator"; $result = $this->construct($matchrule, $matchrule, null);
1538
		$_212 = NULL;
0 ignored issues
show
Unused Code introduced by
$_212 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1539
		do {
0 ignored issues
show
Unused Code introduced by
do { $res_209 = $res... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1540
			$res_209 = $result;
1541
			$pos_209 = $this->pos;
1542
			if (( $subres = $this->literal( '||' ) ) !== FALSE) {
1543
				$result["text"] .= $subres;
1544
				$_212 = TRUE; break;
1545
			}
1546
			$result = $res_209;
1547
			$this->pos = $pos_209;
1548
			if (( $subres = $this->literal( '&&' ) ) !== FALSE) {
1549
				$result["text"] .= $subres;
1550
				$_212 = TRUE; break;
1551
			}
1552
			$result = $res_209;
1553
			$this->pos = $pos_209;
1554
			$_212 = FALSE; break;
1555
		}
1556
		while(0);
1557
		if( $_212 === TRUE ) { return $this->finalise($result); }
1558
		if( $_212 === FALSE) { return FALSE; }
1559
	}
1560
1561
1562
	/* IfArgument: :IfArgumentPortion ( < :BooleanOperator < :IfArgumentPortion )* */
1563
	protected $match_IfArgument_typestack = array('IfArgument');
1564
	function match_IfArgument ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1565
		$matchrule = "IfArgument"; $result = $this->construct($matchrule, $matchrule, null);
1566
		$_221 = NULL;
0 ignored issues
show
Unused Code introduced by
$_221 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1567
		do {
0 ignored issues
show
Unused Code introduced by
do { $matcher = 'mat... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1568
			$matcher = 'match_'.'IfArgumentPortion'; $key = $matcher; $pos = $this->pos;
1569
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1570
			if ($subres !== FALSE) {
1571
				$this->store( $result, $subres, "IfArgumentPortion" );
1572
			}
1573
			else { $_221 = FALSE; break; }
1574
			while (true) {
1575
				$res_220 = $result;
1576
				$pos_220 = $this->pos;
1577
				$_219 = NULL;
0 ignored issues
show
Unused Code introduced by
$_219 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1578
				do {
1579
					if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1580
					$matcher = 'match_'.'BooleanOperator'; $key = $matcher; $pos = $this->pos;
1581
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1582
					if ($subres !== FALSE) {
1583
						$this->store( $result, $subres, "BooleanOperator" );
1584
					}
1585
					else { $_219 = FALSE; break; }
1586
					if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1587
					$matcher = 'match_'.'IfArgumentPortion'; $key = $matcher; $pos = $this->pos;
1588
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1589
					if ($subres !== FALSE) {
1590
						$this->store( $result, $subres, "IfArgumentPortion" );
1591
					}
1592
					else { $_219 = FALSE; break; }
1593
					$_219 = TRUE; break;
1594
				}
1595
				while(0);
1596
				if( $_219 === FALSE) {
1597
					$result = $res_220;
1598
					$this->pos = $pos_220;
1599
					unset( $res_220 );
1600
					unset( $pos_220 );
1601
					break;
1602
				}
1603
			}
1604
			$_221 = TRUE; break;
1605
		}
1606
		while(0);
1607
		if( $_221 === TRUE ) { return $this->finalise($result); }
1608
		if( $_221 === FALSE) { return FALSE; }
1609
	}
1610
1611
1612
1613
	function IfArgument_IfArgumentPortion(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1614
		$res['php'] .= $sub['php'];
1615
	}
1616
1617
	function IfArgument_BooleanOperator(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1618
		$res['php'] .= $sub['text'];
1619
	}
1620
1621
	/* IfPart: '<%' < 'if' [ :IfArgument > '%>' Template:$TemplateMatcher? */
1622
	protected $match_IfPart_typestack = array('IfPart');
1623 View Code Duplication
	function match_IfPart ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1624
		$matchrule = "IfPart"; $result = $this->construct($matchrule, $matchrule, null);
1625
		$_231 = NULL;
0 ignored issues
show
Unused Code introduced by
$_231 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1626
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1627
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
1628
			else { $_231 = FALSE; break; }
1629
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1630
			if (( $subres = $this->literal( 'if' ) ) !== FALSE) { $result["text"] .= $subres; }
1631
			else { $_231 = FALSE; break; }
1632
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1633
			else { $_231 = FALSE; break; }
1634
			$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos;
1635
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1636
			if ($subres !== FALSE) {
1637
				$this->store( $result, $subres, "IfArgument" );
1638
			}
1639
			else { $_231 = FALSE; break; }
1640
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1641
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
1642
			else { $_231 = FALSE; break; }
1643
			$res_230 = $result;
1644
			$pos_230 = $this->pos;
1645
			$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
1646
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1647
			if ($subres !== FALSE) {
1648
				$this->store( $result, $subres, "Template" );
1649
			}
1650
			else {
1651
				$result = $res_230;
1652
				$this->pos = $pos_230;
1653
				unset( $res_230 );
1654
				unset( $pos_230 );
1655
			}
1656
			$_231 = TRUE; break;
1657
		}
1658
		while(0);
1659
		if( $_231 === TRUE ) { return $this->finalise($result); }
1660
		if( $_231 === FALSE) { return FALSE; }
1661
	}
1662
1663
1664
	/* ElseIfPart: '<%' < 'else_if' [ :IfArgument > '%>' Template:$TemplateMatcher? */
1665
	protected $match_ElseIfPart_typestack = array('ElseIfPart');
1666 View Code Duplication
	function match_ElseIfPart ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1667
		$matchrule = "ElseIfPart"; $result = $this->construct($matchrule, $matchrule, null);
1668
		$_241 = NULL;
0 ignored issues
show
Unused Code introduced by
$_241 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1669
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1670
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
1671
			else { $_241 = FALSE; break; }
1672
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1673
			if (( $subres = $this->literal( 'else_if' ) ) !== FALSE) { $result["text"] .= $subres; }
1674
			else { $_241 = FALSE; break; }
1675
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1676
			else { $_241 = FALSE; break; }
1677
			$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos;
1678
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1679
			if ($subres !== FALSE) {
1680
				$this->store( $result, $subres, "IfArgument" );
1681
			}
1682
			else { $_241 = FALSE; break; }
1683
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1684
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
1685
			else { $_241 = FALSE; break; }
1686
			$res_240 = $result;
1687
			$pos_240 = $this->pos;
1688
			$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
1689
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1690
			if ($subres !== FALSE) {
1691
				$this->store( $result, $subres, "Template" );
1692
			}
1693
			else {
1694
				$result = $res_240;
1695
				$this->pos = $pos_240;
1696
				unset( $res_240 );
1697
				unset( $pos_240 );
1698
			}
1699
			$_241 = TRUE; break;
1700
		}
1701
		while(0);
1702
		if( $_241 === TRUE ) { return $this->finalise($result); }
1703
		if( $_241 === FALSE) { return FALSE; }
1704
	}
1705
1706
1707
	/* ElsePart: '<%' < 'else' > '%>' Template:$TemplateMatcher? */
1708
	protected $match_ElsePart_typestack = array('ElsePart');
1709
	function match_ElsePart ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1710
		$matchrule = "ElsePart"; $result = $this->construct($matchrule, $matchrule, null);
1711
		$_249 = NULL;
0 ignored issues
show
Unused Code introduced by
$_249 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1712
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1713
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
1714
			else { $_249 = FALSE; break; }
1715
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1716
			if (( $subres = $this->literal( 'else' ) ) !== FALSE) { $result["text"] .= $subres; }
1717
			else { $_249 = FALSE; break; }
1718
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1719
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
1720
			else { $_249 = FALSE; break; }
1721
			$res_248 = $result;
1722
			$pos_248 = $this->pos;
1723
			$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
1724
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1725
			if ($subres !== FALSE) {
1726
				$this->store( $result, $subres, "Template" );
1727
			}
1728
			else {
1729
				$result = $res_248;
1730
				$this->pos = $pos_248;
1731
				unset( $res_248 );
1732
				unset( $pos_248 );
1733
			}
1734
			$_249 = TRUE; break;
1735
		}
1736
		while(0);
1737
		if( $_249 === TRUE ) { return $this->finalise($result); }
1738
		if( $_249 === FALSE) { return FALSE; }
1739
	}
1740
1741
1742
	/* If: IfPart ElseIfPart* ElsePart? '<%' < 'end_if' > '%>' */
1743
	protected $match_If_typestack = array('If');
1744
	function match_If ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1745
		$matchrule = "If"; $result = $this->construct($matchrule, $matchrule, null);
1746
		$_259 = NULL;
0 ignored issues
show
Unused Code introduced by
$_259 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1747
		do {
0 ignored issues
show
Unused Code introduced by
do { $matcher = 'mat... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1748
			$matcher = 'match_'.'IfPart'; $key = $matcher; $pos = $this->pos;
1749
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1750
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
1751
			else { $_259 = FALSE; break; }
1752
			while (true) {
1753
				$res_252 = $result;
1754
				$pos_252 = $this->pos;
1755
				$matcher = 'match_'.'ElseIfPart'; $key = $matcher; $pos = $this->pos;
1756
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1757 View Code Duplication
				if ($subres !== FALSE) { $this->store( $result, $subres ); }
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1758
				else {
1759
					$result = $res_252;
1760
					$this->pos = $pos_252;
1761
					unset( $res_252 );
1762
					unset( $pos_252 );
1763
					break;
1764
				}
1765
			}
1766
			$res_253 = $result;
1767
			$pos_253 = $this->pos;
1768
			$matcher = 'match_'.'ElsePart'; $key = $matcher; $pos = $this->pos;
1769
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1770 View Code Duplication
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1771
			else {
1772
				$result = $res_253;
1773
				$this->pos = $pos_253;
1774
				unset( $res_253 );
1775
				unset( $pos_253 );
1776
			}
1777
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
1778
			else { $_259 = FALSE; break; }
1779
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1780
			if (( $subres = $this->literal( 'end_if' ) ) !== FALSE) { $result["text"] .= $subres; }
1781
			else { $_259 = FALSE; break; }
1782
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1783
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
1784
			else { $_259 = FALSE; break; }
1785
			$_259 = TRUE; break;
1786
		}
1787
		while(0);
1788
		if( $_259 === TRUE ) { return $this->finalise($result); }
1789
		if( $_259 === FALSE) { return FALSE; }
1790
	}
1791
1792
1793
1794
	function If_IfPart(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1795
		$res['php'] = 
1796
			'if (' . $sub['IfArgument']['php'] . ') { ' . PHP_EOL .
1797
				(isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL .
1798
			'}';
1799
	} 
1800
1801
	function If_ElseIfPart(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1802
		$res['php'] .= 
1803
			'else if (' . $sub['IfArgument']['php'] . ') { ' . PHP_EOL .
1804
				(isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL .
1805
			'}';
1806
	}
1807
1808
	function If_ElsePart(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1809
		$res['php'] .= 
1810
			'else { ' . PHP_EOL . 
1811
				(isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL .
1812
			'}';
1813
	}
1814
1815
	/* Require: '<%' < 'require' [ Call:(Method:Word "(" < :CallArguments  > ")") > '%>' */
1816
	protected $match_Require_typestack = array('Require');
1817
	function match_Require ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1818
		$matchrule = "Require"; $result = $this->construct($matchrule, $matchrule, null);
1819
		$_275 = NULL;
0 ignored issues
show
Unused Code introduced by
$_275 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1820
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1821
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
1822
			else { $_275 = FALSE; break; }
1823
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1824
			if (( $subres = $this->literal( 'require' ) ) !== FALSE) { $result["text"] .= $subres; }
1825
			else { $_275 = FALSE; break; }
1826
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1827
			else { $_275 = FALSE; break; }
1828
			$stack[] = $result; $result = $this->construct( $matchrule, "Call" ); 
1829
			$_271 = NULL;
0 ignored issues
show
Unused Code introduced by
$_271 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1830
			do {
1831
				$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
1832
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1833
				if ($subres !== FALSE) {
1834
					$this->store( $result, $subres, "Method" );
1835
				}
1836
				else { $_271 = FALSE; break; }
1837
				if (substr($this->string,$this->pos,1) == '(') {
1838
					$this->pos += 1;
1839
					$result["text"] .= '(';
1840
				}
1841
				else { $_271 = FALSE; break; }
1842
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1843
				$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
1844
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1845
				if ($subres !== FALSE) {
1846
					$this->store( $result, $subres, "CallArguments" );
1847
				}
1848
				else { $_271 = FALSE; break; }
1849
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1850
				if (substr($this->string,$this->pos,1) == ')') {
1851
					$this->pos += 1;
1852
					$result["text"] .= ')';
1853
				}
1854
				else { $_271 = FALSE; break; }
1855
				$_271 = TRUE; break;
1856
			}
1857
			while(0);
1858
			if( $_271 === TRUE ) {
1859
				$subres = $result; $result = array_pop($stack);
1860
				$this->store( $result, $subres, 'Call' );
1861
			}
1862
			if( $_271 === FALSE) {
1863
				$result = array_pop($stack);
1864
				$_275 = FALSE; break;
1865
			}
1866
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1867
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
1868
			else { $_275 = FALSE; break; }
1869
			$_275 = TRUE; break;
1870
		}
1871
		while(0);
1872
		if( $_275 === TRUE ) { return $this->finalise($result); }
1873
		if( $_275 === FALSE) { return FALSE; }
1874
	}
1875
1876
1877
1878
	function Require_Call(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1879
		$res['php'] = "Requirements::".$sub['Method']['text'].'('.$sub['CallArguments']['php'].');';
1880
	}
1881
1882
	
1883
	/* CacheBlockArgument:
1884
   !( "if " | "unless " )
1885
	( 
1886
		:DollarMarkedLookup |
1887
		:QuotedString |
1888
		:Lookup
1889
	) */
1890
	protected $match_CacheBlockArgument_typestack = array('CacheBlockArgument');
1891
	function match_CacheBlockArgument ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1892
		$matchrule = "CacheBlockArgument"; $result = $this->construct($matchrule, $matchrule, null);
1893
		$_295 = NULL;
0 ignored issues
show
Unused Code introduced by
$_295 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1894
		do {
0 ignored issues
show
Unused Code introduced by
do { $res_283 = $res... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
1895
			$res_283 = $result;
1896
			$pos_283 = $this->pos;
1897
			$_282 = NULL;
0 ignored issues
show
Unused Code introduced by
$_282 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1898
			do {
1899
				$_280 = NULL;
0 ignored issues
show
Unused Code introduced by
$_280 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1900
				do {
1901
					$res_277 = $result;
1902
					$pos_277 = $this->pos;
1903
					if (( $subres = $this->literal( 'if ' ) ) !== FALSE) {
1904
						$result["text"] .= $subres;
1905
						$_280 = TRUE; break;
1906
					}
1907
					$result = $res_277;
1908
					$this->pos = $pos_277;
1909
					if (( $subres = $this->literal( 'unless ' ) ) !== FALSE) {
1910
						$result["text"] .= $subres;
1911
						$_280 = TRUE; break;
1912
					}
1913
					$result = $res_277;
1914
					$this->pos = $pos_277;
1915
					$_280 = FALSE; break;
1916
				}
1917
				while(0);
1918
				if( $_280 === FALSE) { $_282 = FALSE; break; }
1919
				$_282 = TRUE; break;
1920
			}
1921
			while(0);
1922
			if( $_282 === TRUE ) {
1923
				$result = $res_283;
1924
				$this->pos = $pos_283;
1925
				$_295 = FALSE; break;
1926
			}
1927
			if( $_282 === FALSE) {
1928
				$result = $res_283;
1929
				$this->pos = $pos_283;
1930
			}
1931
			$_293 = NULL;
0 ignored issues
show
Unused Code introduced by
$_293 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1932 View Code Duplication
			do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1933
				$_291 = NULL;
0 ignored issues
show
Unused Code introduced by
$_291 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1934
				do {
1935
					$res_284 = $result;
1936
					$pos_284 = $this->pos;
1937
					$matcher = 'match_'.'DollarMarkedLookup'; $key = $matcher; $pos = $this->pos;
1938
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1939
					if ($subres !== FALSE) {
1940
						$this->store( $result, $subres, "DollarMarkedLookup" );
1941
						$_291 = TRUE; break;
1942
					}
1943
					$result = $res_284;
1944
					$this->pos = $pos_284;
1945
					$_289 = NULL;
0 ignored issues
show
Unused Code introduced by
$_289 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1946
					do {
1947
						$res_286 = $result;
1948
						$pos_286 = $this->pos;
1949
						$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
1950
						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1951
						if ($subres !== FALSE) {
1952
							$this->store( $result, $subres, "QuotedString" );
1953
							$_289 = TRUE; break;
1954
						}
1955
						$result = $res_286;
1956
						$this->pos = $pos_286;
1957
						$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
1958
						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1959
						if ($subres !== FALSE) {
1960
							$this->store( $result, $subres, "Lookup" );
1961
							$_289 = TRUE; break;
1962
						}
1963
						$result = $res_286;
1964
						$this->pos = $pos_286;
1965
						$_289 = FALSE; break;
1966
					}
1967
					while(0);
1968
					if( $_289 === TRUE ) { $_291 = TRUE; break; }
1969
					$result = $res_284;
1970
					$this->pos = $pos_284;
1971
					$_291 = FALSE; break;
1972
				}
1973
				while(0);
1974
				if( $_291 === FALSE) { $_293 = FALSE; break; }
1975
				$_293 = TRUE; break;
1976
			}
1977
			while(0);
1978
			if( $_293 === FALSE) { $_295 = FALSE; break; }
1979
			$_295 = TRUE; break;
1980
		}
1981
		while(0);
1982
		if( $_295 === TRUE ) { return $this->finalise($result); }
1983
		if( $_295 === FALSE) { return FALSE; }
1984
	}
1985
1986
1987
1988
	function CacheBlockArgument_DollarMarkedLookup(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1989
		$res['php'] = $sub['Lookup']['php'];
1990
	}
1991
	
1992
	function CacheBlockArgument_QuotedString(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1993
		$res['php'] = "'" . str_replace("'", "\\'", $sub['String']['text']) . "'";
1994
	}
1995
	
1996
	function CacheBlockArgument_Lookup(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
1997
		$res['php'] = $sub['php'];
1998
	}
1999
		
2000
	/* CacheBlockArguments: CacheBlockArgument ( < "," < CacheBlockArgument )* */
2001
	protected $match_CacheBlockArguments_typestack = array('CacheBlockArguments');
2002 View Code Duplication
	function match_CacheBlockArguments ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2003
		$matchrule = "CacheBlockArguments"; $result = $this->construct($matchrule, $matchrule, null);
2004
		$_304 = NULL;
0 ignored issues
show
Unused Code introduced by
$_304 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2005
		do {
0 ignored issues
show
Unused Code introduced by
do { $matcher = 'mat... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
2006
			$matcher = 'match_'.'CacheBlockArgument'; $key = $matcher; $pos = $this->pos;
2007
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2008
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
2009
			else { $_304 = FALSE; break; }
2010
			while (true) {
2011
				$res_303 = $result;
2012
				$pos_303 = $this->pos;
2013
				$_302 = NULL;
0 ignored issues
show
Unused Code introduced by
$_302 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2014
				do {
2015
					if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2016
					if (substr($this->string,$this->pos,1) == ',') {
2017
						$this->pos += 1;
2018
						$result["text"] .= ',';
2019
					}
2020
					else { $_302 = FALSE; break; }
2021
					if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2022
					$matcher = 'match_'.'CacheBlockArgument'; $key = $matcher; $pos = $this->pos;
2023
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2024
					if ($subres !== FALSE) { $this->store( $result, $subres ); }
2025
					else { $_302 = FALSE; break; }
2026
					$_302 = TRUE; break;
2027
				}
2028
				while(0);
2029
				if( $_302 === FALSE) {
2030
					$result = $res_303;
2031
					$this->pos = $pos_303;
2032
					unset( $res_303 );
2033
					unset( $pos_303 );
2034
					break;
2035
				}
2036
			}
2037
			$_304 = TRUE; break;
2038
		}
2039
		while(0);
2040
		if( $_304 === TRUE ) { return $this->finalise($result); }
2041
		if( $_304 === FALSE) { return FALSE; }
2042
	}
2043
2044
2045
2046
	function CacheBlockArguments_CacheBlockArgument(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
2047 View Code Duplication
		if (!empty($res['php'])) $res['php'] .= ".'_'.";
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2048
		else $res['php'] = '';
2049
		
2050
		$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']);
2051
	}
2052
	
2053
	/* CacheBlockTemplate: (Comment | Translate | If | Require |    OldI18NTag | Include | ClosedBlock |
2054
	OpenBlock | MalformedBlock | Injection | Text)+ */
2055
	protected $match_CacheBlockTemplate_typestack = array('CacheBlockTemplate','Template');
2056
	function match_CacheBlockTemplate ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
2057
		$matchrule = "CacheBlockTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'CacheRestrictedTemplate'));
2058
		$count = 0;
2059
		while (true) {
2060
			$res_348 = $result;
2061
			$pos_348 = $this->pos;
2062
			$_347 = NULL;
0 ignored issues
show
Unused Code introduced by
$_347 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2063
			do {
0 ignored issues
show
Unused Code introduced by
do { $_345 = NULL; ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
2064
				$_345 = NULL;
0 ignored issues
show
Unused Code introduced by
$_345 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2065
				do {
2066
					$res_306 = $result;
2067
					$pos_306 = $this->pos;
2068
					$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
2069
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2070
					if ($subres !== FALSE) {
2071
						$this->store( $result, $subres );
2072
						$_345 = TRUE; break;
2073
					}
2074
					$result = $res_306;
2075
					$this->pos = $pos_306;
2076
					$_343 = NULL;
0 ignored issues
show
Unused Code introduced by
$_343 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2077
					do {
2078
						$res_308 = $result;
2079
						$pos_308 = $this->pos;
2080
						$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
2081
						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2082
						if ($subres !== FALSE) {
2083
							$this->store( $result, $subres );
2084
							$_343 = TRUE; break;
2085
						}
2086
						$result = $res_308;
2087
						$this->pos = $pos_308;
2088
						$_341 = NULL;
0 ignored issues
show
Unused Code introduced by
$_341 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2089
						do {
2090
							$res_310 = $result;
2091
							$pos_310 = $this->pos;
2092
							$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
2093
							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2094
							if ($subres !== FALSE) {
2095
								$this->store( $result, $subres );
2096
								$_341 = TRUE; break;
2097
							}
2098
							$result = $res_310;
2099
							$this->pos = $pos_310;
2100
							$_339 = NULL;
0 ignored issues
show
Unused Code introduced by
$_339 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2101
							do {
2102
								$res_312 = $result;
2103
								$pos_312 = $this->pos;
2104
								$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
2105
								$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2106
								if ($subres !== FALSE) {
2107
									$this->store( $result, $subres );
2108
									$_339 = TRUE; break;
2109
								}
2110
								$result = $res_312;
2111
								$this->pos = $pos_312;
2112
								$_337 = NULL;
0 ignored issues
show
Unused Code introduced by
$_337 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2113
								do {
2114
									$res_314 = $result;
2115
									$pos_314 = $this->pos;
2116
									$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
2117
									$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2118
									if ($subres !== FALSE) {
2119
										$this->store( $result, $subres );
2120
										$_337 = TRUE; break;
2121
									}
2122
									$result = $res_314;
2123
									$this->pos = $pos_314;
2124
									$_335 = NULL;
0 ignored issues
show
Unused Code introduced by
$_335 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2125
									do {
2126
										$res_316 = $result;
2127
										$pos_316 = $this->pos;
2128
										$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
2129
										$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2130
										if ($subres !== FALSE) {
2131
											$this->store( $result, $subres );
2132
											$_335 = TRUE; break;
2133
										}
2134
										$result = $res_316;
2135
										$this->pos = $pos_316;
2136
										$_333 = NULL;
0 ignored issues
show
Unused Code introduced by
$_333 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2137
										do {
2138
											$res_318 = $result;
2139
											$pos_318 = $this->pos;
2140
											$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
2141
											$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2142
											if ($subres !== FALSE) {
2143
												$this->store( $result, $subres );
2144
												$_333 = TRUE; break;
2145
											}
2146
											$result = $res_318;
2147
											$this->pos = $pos_318;
2148
											$_331 = NULL;
0 ignored issues
show
Unused Code introduced by
$_331 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2149
											do {
2150
												$res_320 = $result;
2151
												$pos_320 = $this->pos;
2152
												$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
2153
												$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2154
												if ($subres !== FALSE) {
2155
													$this->store( $result, $subres );
2156
													$_331 = TRUE; break;
2157
												}
2158
												$result = $res_320;
2159
												$this->pos = $pos_320;
2160
												$_329 = NULL;
0 ignored issues
show
Unused Code introduced by
$_329 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2161
												do {
2162
													$res_322 = $result;
2163
													$pos_322 = $this->pos;
2164
													$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
2165
													$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2166
													if ($subres !== FALSE) {
2167
														$this->store( $result, $subres );
2168
														$_329 = TRUE; break;
2169
													}
2170
													$result = $res_322;
2171
													$this->pos = $pos_322;
2172
													$_327 = NULL;
0 ignored issues
show
Unused Code introduced by
$_327 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2173
													do {
2174
														$res_324 = $result;
2175
														$pos_324 = $this->pos;
2176
														$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
2177
														$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2178
														if ($subres !== FALSE) {
2179
															$this->store( $result, $subres );
2180
															$_327 = TRUE; break;
2181
														}
2182
														$result = $res_324;
2183
														$this->pos = $pos_324;
2184
														$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
2185
														$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2186
														if ($subres !== FALSE) {
2187
															$this->store( $result, $subres );
2188
															$_327 = TRUE; break;
2189
														}
2190
														$result = $res_324;
2191
														$this->pos = $pos_324;
2192
														$_327 = FALSE; break;
2193
													}
2194
													while(0);
2195
													if( $_327 === TRUE ) { $_329 = TRUE; break; }
2196
													$result = $res_322;
2197
													$this->pos = $pos_322;
2198
													$_329 = FALSE; break;
2199
												}
2200
												while(0);
2201
												if( $_329 === TRUE ) { $_331 = TRUE; break; }
2202
												$result = $res_320;
2203
												$this->pos = $pos_320;
2204
												$_331 = FALSE; break;
2205
											}
2206
											while(0);
2207
											if( $_331 === TRUE ) { $_333 = TRUE; break; }
2208
											$result = $res_318;
2209
											$this->pos = $pos_318;
2210
											$_333 = FALSE; break;
2211
										}
2212
										while(0);
2213
										if( $_333 === TRUE ) { $_335 = TRUE; break; }
2214
										$result = $res_316;
2215
										$this->pos = $pos_316;
2216
										$_335 = FALSE; break;
2217
									}
2218
									while(0);
2219
									if( $_335 === TRUE ) { $_337 = TRUE; break; }
2220
									$result = $res_314;
2221
									$this->pos = $pos_314;
2222
									$_337 = FALSE; break;
2223
								}
2224
								while(0);
2225
								if( $_337 === TRUE ) { $_339 = TRUE; break; }
2226
								$result = $res_312;
2227
								$this->pos = $pos_312;
2228
								$_339 = FALSE; break;
2229
							}
2230
							while(0);
2231
							if( $_339 === TRUE ) { $_341 = TRUE; break; }
2232
							$result = $res_310;
2233
							$this->pos = $pos_310;
2234
							$_341 = FALSE; break;
2235
						}
2236
						while(0);
2237
						if( $_341 === TRUE ) { $_343 = TRUE; break; }
2238
						$result = $res_308;
2239
						$this->pos = $pos_308;
2240
						$_343 = FALSE; break;
2241
					}
2242
					while(0);
2243
					if( $_343 === TRUE ) { $_345 = TRUE; break; }
2244
					$result = $res_306;
2245
					$this->pos = $pos_306;
2246
					$_345 = FALSE; break;
2247
				}
2248
				while(0);
2249
				if( $_345 === FALSE) { $_347 = FALSE; break; }
2250
				$_347 = TRUE; break;
2251
			}
2252
			while(0);
2253
			if( $_347 === FALSE) {
2254
				$result = $res_348;
2255
				$this->pos = $pos_348;
2256
				unset( $res_348 );
2257
				unset( $pos_348 );
2258
				break;
2259
			}
2260
			$count += 1;
2261
		}
2262
		if ($count > 0) { return $this->finalise($result); }
2263
		else { return FALSE; }
2264
	}
2265
2266
2267
2268
		
2269
	/* UncachedBlock: 
2270
	'<%' < "uncached" < CacheBlockArguments? ( < Conditional:("if"|"unless") > Condition:IfArgument )? > '%>'
2271
		Template:$TemplateMatcher?
2272
		'<%' < 'end_' ("uncached"|"cached"|"cacheblock") > '%>' */
2273
	protected $match_UncachedBlock_typestack = array('UncachedBlock');
2274
	function match_UncachedBlock ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
2275
		$matchrule = "UncachedBlock"; $result = $this->construct($matchrule, $matchrule, null);
2276
		$_385 = NULL;
0 ignored issues
show
Unused Code introduced by
$_385 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2277
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
2278
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
2279
			else { $_385 = FALSE; break; }
2280
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2281
			if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) { $result["text"] .= $subres; }
2282
			else { $_385 = FALSE; break; }
2283
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2284
			$res_353 = $result;
2285
			$pos_353 = $this->pos;
2286
			$matcher = 'match_'.'CacheBlockArguments'; $key = $matcher; $pos = $this->pos;
2287
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2288 View Code Duplication
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2289
			else {
2290
				$result = $res_353;
2291
				$this->pos = $pos_353;
2292
				unset( $res_353 );
2293
				unset( $pos_353 );
2294
			}
2295
			$res_365 = $result;
2296
			$pos_365 = $this->pos;
2297
			$_364 = NULL;
0 ignored issues
show
Unused Code introduced by
$_364 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2298 View Code Duplication
			do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2299
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2300
				$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); 
2301
				$_360 = NULL;
0 ignored issues
show
Unused Code introduced by
$_360 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2302
				do {
2303
					$_358 = NULL;
0 ignored issues
show
Unused Code introduced by
$_358 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2304
					do {
2305
						$res_355 = $result;
2306
						$pos_355 = $this->pos;
2307
						if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
2308
							$result["text"] .= $subres;
2309
							$_358 = TRUE; break;
2310
						}
2311
						$result = $res_355;
2312
						$this->pos = $pos_355;
2313
						if (( $subres = $this->literal( 'unless' ) ) !== FALSE) {
2314
							$result["text"] .= $subres;
2315
							$_358 = TRUE; break;
2316
						}
2317
						$result = $res_355;
2318
						$this->pos = $pos_355;
2319
						$_358 = FALSE; break;
2320
					}
2321
					while(0);
2322
					if( $_358 === FALSE) { $_360 = FALSE; break; }
2323
					$_360 = TRUE; break;
2324
				}
2325
				while(0);
2326
				if( $_360 === TRUE ) {
2327
					$subres = $result; $result = array_pop($stack);
2328
					$this->store( $result, $subres, 'Conditional' );
2329
				}
2330
				if( $_360 === FALSE) {
2331
					$result = array_pop($stack);
2332
					$_364 = FALSE; break;
2333
				}
2334
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2335
				$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos;
2336
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2337
				if ($subres !== FALSE) {
2338
					$this->store( $result, $subres, "Condition" );
2339
				}
2340
				else { $_364 = FALSE; break; }
2341
				$_364 = TRUE; break;
2342
			}
2343
			while(0);
2344
			if( $_364 === FALSE) {
2345
				$result = $res_365;
2346
				$this->pos = $pos_365;
2347
				unset( $res_365 );
2348
				unset( $pos_365 );
2349
			}
2350
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2351
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
2352
			else { $_385 = FALSE; break; }
2353
			$res_368 = $result;
2354
			$pos_368 = $this->pos;
2355
			$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
2356
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2357
			if ($subres !== FALSE) {
2358
				$this->store( $result, $subres, "Template" );
2359
			}
2360
			else {
2361
				$result = $res_368;
2362
				$this->pos = $pos_368;
2363
				unset( $res_368 );
2364
				unset( $pos_368 );
2365
			}
2366
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
2367
			else { $_385 = FALSE; break; }
2368
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2369
			if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
2370
			else { $_385 = FALSE; break; }
2371
			$_381 = NULL;
0 ignored issues
show
Unused Code introduced by
$_381 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2372 View Code Duplication
			do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2373
				$_379 = NULL;
0 ignored issues
show
Unused Code introduced by
$_379 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2374
				do {
2375
					$res_372 = $result;
2376
					$pos_372 = $this->pos;
2377
					if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
2378
						$result["text"] .= $subres;
2379
						$_379 = TRUE; break;
2380
					}
2381
					$result = $res_372;
2382
					$this->pos = $pos_372;
2383
					$_377 = NULL;
0 ignored issues
show
Unused Code introduced by
$_377 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2384
					do {
2385
						$res_374 = $result;
2386
						$pos_374 = $this->pos;
2387
						if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
2388
							$result["text"] .= $subres;
2389
							$_377 = TRUE; break;
2390
						}
2391
						$result = $res_374;
2392
						$this->pos = $pos_374;
2393
						if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
2394
							$result["text"] .= $subres;
2395
							$_377 = TRUE; break;
2396
						}
2397
						$result = $res_374;
2398
						$this->pos = $pos_374;
2399
						$_377 = FALSE; break;
2400
					}
2401
					while(0);
2402
					if( $_377 === TRUE ) { $_379 = TRUE; break; }
2403
					$result = $res_372;
2404
					$this->pos = $pos_372;
2405
					$_379 = FALSE; break;
2406
				}
2407
				while(0);
2408
				if( $_379 === FALSE) { $_381 = FALSE; break; }
2409
				$_381 = TRUE; break;
2410
			}
2411
			while(0);
2412
			if( $_381 === FALSE) { $_385 = FALSE; break; }
2413
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2414
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
2415
			else { $_385 = FALSE; break; }
2416
			$_385 = TRUE; break;
2417
		}
2418
		while(0);
2419
		if( $_385 === TRUE ) { return $this->finalise($result); }
2420
		if( $_385 === FALSE) { return FALSE; }
2421
	}
2422
2423
2424
2425
	function UncachedBlock_Template(&$res, $sub){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
2426
		$res['php'] = $sub['php'];
2427
	}
2428
	
2429
	/* CacheRestrictedTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock |
2430
	OpenBlock | MalformedBlock | Injection | Text)+ */
2431
	protected $match_CacheRestrictedTemplate_typestack = array('CacheRestrictedTemplate','Template');
2432 View Code Duplication
	function match_CacheRestrictedTemplate ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2433
		$matchrule = "CacheRestrictedTemplate"; $result = $this->construct($matchrule, $matchrule, null);
2434
		$count = 0;
2435
		while (true) {
2436
			$res_437 = $result;
2437
			$pos_437 = $this->pos;
2438
			$_436 = NULL;
0 ignored issues
show
Unused Code introduced by
$_436 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2439
			do {
0 ignored issues
show
Unused Code introduced by
do { $_434 = NULL; ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
2440
				$_434 = NULL;
0 ignored issues
show
Unused Code introduced by
$_434 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2441
				do {
2442
					$res_387 = $result;
2443
					$pos_387 = $this->pos;
2444
					$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
2445
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2446
					if ($subres !== FALSE) {
2447
						$this->store( $result, $subres );
2448
						$_434 = TRUE; break;
2449
					}
2450
					$result = $res_387;
2451
					$this->pos = $pos_387;
2452
					$_432 = NULL;
0 ignored issues
show
Unused Code introduced by
$_432 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2453
					do {
2454
						$res_389 = $result;
2455
						$pos_389 = $this->pos;
2456
						$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
2457
						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2458
						if ($subres !== FALSE) {
2459
							$this->store( $result, $subres );
2460
							$_432 = TRUE; break;
2461
						}
2462
						$result = $res_389;
2463
						$this->pos = $pos_389;
2464
						$_430 = NULL;
0 ignored issues
show
Unused Code introduced by
$_430 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2465
						do {
2466
							$res_391 = $result;
2467
							$pos_391 = $this->pos;
2468
							$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
2469
							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2470
							if ($subres !== FALSE) {
2471
								$this->store( $result, $subres );
2472
								$_430 = TRUE; break;
2473
							}
2474
							$result = $res_391;
2475
							$this->pos = $pos_391;
2476
							$_428 = NULL;
0 ignored issues
show
Unused Code introduced by
$_428 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2477
							do {
2478
								$res_393 = $result;
2479
								$pos_393 = $this->pos;
2480
								$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
2481
								$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2482
								if ($subres !== FALSE) {
2483
									$this->store( $result, $subres );
2484
									$_428 = TRUE; break;
2485
								}
2486
								$result = $res_393;
2487
								$this->pos = $pos_393;
2488
								$_426 = NULL;
0 ignored issues
show
Unused Code introduced by
$_426 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2489
								do {
2490
									$res_395 = $result;
2491
									$pos_395 = $this->pos;
2492
									$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
2493
									$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2494
									if ($subres !== FALSE) {
2495
										$this->store( $result, $subres );
2496
										$_426 = TRUE; break;
2497
									}
2498
									$result = $res_395;
2499
									$this->pos = $pos_395;
2500
									$_424 = NULL;
0 ignored issues
show
Unused Code introduced by
$_424 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2501
									do {
2502
										$res_397 = $result;
2503
										$pos_397 = $this->pos;
2504
										$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
2505
										$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2506
										if ($subres !== FALSE) {
2507
											$this->store( $result, $subres );
2508
											$_424 = TRUE; break;
2509
										}
2510
										$result = $res_397;
2511
										$this->pos = $pos_397;
2512
										$_422 = NULL;
0 ignored issues
show
Unused Code introduced by
$_422 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2513
										do {
2514
											$res_399 = $result;
2515
											$pos_399 = $this->pos;
2516
											$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
2517
											$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2518
											if ($subres !== FALSE) {
2519
												$this->store( $result, $subres );
2520
												$_422 = TRUE; break;
2521
											}
2522
											$result = $res_399;
2523
											$this->pos = $pos_399;
2524
											$_420 = NULL;
0 ignored issues
show
Unused Code introduced by
$_420 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2525
											do {
2526
												$res_401 = $result;
2527
												$pos_401 = $this->pos;
2528
												$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
2529
												$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2530
												if ($subres !== FALSE) {
2531
													$this->store( $result, $subres );
2532
													$_420 = TRUE; break;
2533
												}
2534
												$result = $res_401;
2535
												$this->pos = $pos_401;
2536
												$_418 = NULL;
0 ignored issues
show
Unused Code introduced by
$_418 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2537
												do {
2538
													$res_403 = $result;
2539
													$pos_403 = $this->pos;
2540
													$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
2541
													$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2542
													if ($subres !== FALSE) {
2543
														$this->store( $result, $subres );
2544
														$_418 = TRUE; break;
2545
													}
2546
													$result = $res_403;
2547
													$this->pos = $pos_403;
2548
													$_416 = NULL;
0 ignored issues
show
Unused Code introduced by
$_416 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2549
													do {
2550
														$res_405 = $result;
2551
														$pos_405 = $this->pos;
2552
														$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
2553
														$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2554
														if ($subres !== FALSE) {
2555
															$this->store( $result, $subres );
2556
															$_416 = TRUE; break;
2557
														}
2558
														$result = $res_405;
2559
														$this->pos = $pos_405;
2560
														$_414 = NULL;
0 ignored issues
show
Unused Code introduced by
$_414 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2561
														do {
2562
															$res_407 = $result;
2563
															$pos_407 = $this->pos;
2564
															$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
2565
															$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2566
															if ($subres !== FALSE) {
2567
																$this->store( $result, $subres );
2568
																$_414 = TRUE; break;
2569
															}
2570
															$result = $res_407;
2571
															$this->pos = $pos_407;
2572
															$_412 = NULL;
0 ignored issues
show
Unused Code introduced by
$_412 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2573
															do {
2574
																$res_409 = $result;
2575
																$pos_409 = $this->pos;
2576
																$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
2577
																$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2578
																if ($subres !== FALSE) {
2579
																	$this->store( $result, $subres );
2580
																	$_412 = TRUE; break;
2581
																}
2582
																$result = $res_409;
2583
																$this->pos = $pos_409;
2584
																$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
2585
																$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2586
																if ($subres !== FALSE) {
2587
																	$this->store( $result, $subres );
2588
																	$_412 = TRUE; break;
2589
																}
2590
																$result = $res_409;
2591
																$this->pos = $pos_409;
2592
																$_412 = FALSE; break;
2593
															}
2594
															while(0);
2595
															if( $_412 === TRUE ) { $_414 = TRUE; break; }
2596
															$result = $res_407;
2597
															$this->pos = $pos_407;
2598
															$_414 = FALSE; break;
2599
														}
2600
														while(0);
2601
														if( $_414 === TRUE ) { $_416 = TRUE; break; }
2602
														$result = $res_405;
2603
														$this->pos = $pos_405;
2604
														$_416 = FALSE; break;
2605
													}
2606
													while(0);
2607
													if( $_416 === TRUE ) { $_418 = TRUE; break; }
2608
													$result = $res_403;
2609
													$this->pos = $pos_403;
2610
													$_418 = FALSE; break;
2611
												}
2612
												while(0);
2613
												if( $_418 === TRUE ) { $_420 = TRUE; break; }
2614
												$result = $res_401;
2615
												$this->pos = $pos_401;
2616
												$_420 = FALSE; break;
2617
											}
2618
											while(0);
2619
											if( $_420 === TRUE ) { $_422 = TRUE; break; }
2620
											$result = $res_399;
2621
											$this->pos = $pos_399;
2622
											$_422 = FALSE; break;
2623
										}
2624
										while(0);
2625
										if( $_422 === TRUE ) { $_424 = TRUE; break; }
2626
										$result = $res_397;
2627
										$this->pos = $pos_397;
2628
										$_424 = FALSE; break;
2629
									}
2630
									while(0);
2631
									if( $_424 === TRUE ) { $_426 = TRUE; break; }
2632
									$result = $res_395;
2633
									$this->pos = $pos_395;
2634
									$_426 = FALSE; break;
2635
								}
2636
								while(0);
2637
								if( $_426 === TRUE ) { $_428 = TRUE; break; }
2638
								$result = $res_393;
2639
								$this->pos = $pos_393;
2640
								$_428 = FALSE; break;
2641
							}
2642
							while(0);
2643
							if( $_428 === TRUE ) { $_430 = TRUE; break; }
2644
							$result = $res_391;
2645
							$this->pos = $pos_391;
2646
							$_430 = FALSE; break;
2647
						}
2648
						while(0);
2649
						if( $_430 === TRUE ) { $_432 = TRUE; break; }
2650
						$result = $res_389;
2651
						$this->pos = $pos_389;
2652
						$_432 = FALSE; break;
2653
					}
2654
					while(0);
2655
					if( $_432 === TRUE ) { $_434 = TRUE; break; }
2656
					$result = $res_387;
2657
					$this->pos = $pos_387;
2658
					$_434 = FALSE; break;
2659
				}
2660
				while(0);
2661
				if( $_434 === FALSE) { $_436 = FALSE; break; }
2662
				$_436 = TRUE; break;
2663
			}
2664
			while(0);
2665
			if( $_436 === FALSE) {
2666
				$result = $res_437;
2667
				$this->pos = $pos_437;
2668
				unset( $res_437 );
2669
				unset( $pos_437 );
2670
				break;
2671
			}
2672
			$count += 1;
2673
		}
2674
		if ($count > 0) { return $this->finalise($result); }
2675
		else { return FALSE; }
2676
	}
2677
2678
2679
2680
	function CacheRestrictedTemplate_CacheBlock(&$res, $sub) { 
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
2681
		throw new SSTemplateParseException('You cant have cache blocks nested within with, loop or control blocks ' .
2682
			'that are within cache blocks', $this);
2683
	}
2684
	
2685
	function CacheRestrictedTemplate_UncachedBlock(&$res, $sub) { 
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
2686
		throw new SSTemplateParseException('You cant have uncache blocks nested within with, loop or control blocks ' .
2687
			'that are within cache blocks', $this);
2688
	}
2689
	
2690
	/* CacheBlock: 
2691
	'<%' < CacheTag:("cached"|"cacheblock") < (CacheBlockArguments)? ( < Conditional:("if"|"unless") >
2692
	Condition:IfArgument )? > '%>'
2693
		(CacheBlock | UncachedBlock | CacheBlockTemplate)*
2694
	'<%' < 'end_' ("cached"|"uncached"|"cacheblock") > '%>' */
2695
	protected $match_CacheBlock_typestack = array('CacheBlock');
2696
	function match_CacheBlock ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
2697
		$matchrule = "CacheBlock"; $result = $this->construct($matchrule, $matchrule, null);
2698
		$_492 = NULL;
0 ignored issues
show
Unused Code introduced by
$_492 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2699
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
2700
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
2701
			else { $_492 = FALSE; break; }
2702
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2703
			$stack[] = $result; $result = $this->construct( $matchrule, "CacheTag" ); 
2704
			$_445 = NULL;
0 ignored issues
show
Unused Code introduced by
$_445 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2705
			do {
2706
				$_443 = NULL;
0 ignored issues
show
Unused Code introduced by
$_443 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2707
				do {
2708
					$res_440 = $result;
2709
					$pos_440 = $this->pos;
2710
					if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
2711
						$result["text"] .= $subres;
2712
						$_443 = TRUE; break;
2713
					}
2714
					$result = $res_440;
2715
					$this->pos = $pos_440;
2716
					if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
2717
						$result["text"] .= $subres;
2718
						$_443 = TRUE; break;
2719
					}
2720
					$result = $res_440;
2721
					$this->pos = $pos_440;
2722
					$_443 = FALSE; break;
2723
				}
2724
				while(0);
2725
				if( $_443 === FALSE) { $_445 = FALSE; break; }
2726
				$_445 = TRUE; break;
2727
			}
2728
			while(0);
2729
			if( $_445 === TRUE ) {
2730
				$subres = $result; $result = array_pop($stack);
2731
				$this->store( $result, $subres, 'CacheTag' );
2732
			}
2733
			if( $_445 === FALSE) {
2734
				$result = array_pop($stack);
2735
				$_492 = FALSE; break;
2736
			}
2737
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2738
			$res_450 = $result;
2739
			$pos_450 = $this->pos;
2740
			$_449 = NULL;
0 ignored issues
show
Unused Code introduced by
$_449 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2741 View Code Duplication
			do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2742
				$matcher = 'match_'.'CacheBlockArguments'; $key = $matcher; $pos = $this->pos;
2743
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2744
				if ($subres !== FALSE) { $this->store( $result, $subres ); }
2745
				else { $_449 = FALSE; break; }
2746
				$_449 = TRUE; break;
2747
			}
2748
			while(0);
2749
			if( $_449 === FALSE) {
2750
				$result = $res_450;
2751
				$this->pos = $pos_450;
2752
				unset( $res_450 );
2753
				unset( $pos_450 );
2754
			}
2755
			$res_462 = $result;
2756
			$pos_462 = $this->pos;
2757
			$_461 = NULL;
0 ignored issues
show
Unused Code introduced by
$_461 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2758 View Code Duplication
			do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2759
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2760
				$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); 
2761
				$_457 = NULL;
0 ignored issues
show
Unused Code introduced by
$_457 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2762
				do {
2763
					$_455 = NULL;
0 ignored issues
show
Unused Code introduced by
$_455 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2764
					do {
2765
						$res_452 = $result;
2766
						$pos_452 = $this->pos;
2767
						if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
2768
							$result["text"] .= $subres;
2769
							$_455 = TRUE; break;
2770
						}
2771
						$result = $res_452;
2772
						$this->pos = $pos_452;
2773
						if (( $subres = $this->literal( 'unless' ) ) !== FALSE) {
2774
							$result["text"] .= $subres;
2775
							$_455 = TRUE; break;
2776
						}
2777
						$result = $res_452;
2778
						$this->pos = $pos_452;
2779
						$_455 = FALSE; break;
2780
					}
2781
					while(0);
2782
					if( $_455 === FALSE) { $_457 = FALSE; break; }
2783
					$_457 = TRUE; break;
2784
				}
2785
				while(0);
2786
				if( $_457 === TRUE ) {
2787
					$subres = $result; $result = array_pop($stack);
2788
					$this->store( $result, $subres, 'Conditional' );
2789
				}
2790
				if( $_457 === FALSE) {
2791
					$result = array_pop($stack);
2792
					$_461 = FALSE; break;
2793
				}
2794
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2795
				$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos;
2796
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2797
				if ($subres !== FALSE) {
2798
					$this->store( $result, $subres, "Condition" );
2799
				}
2800
				else { $_461 = FALSE; break; }
2801
				$_461 = TRUE; break;
2802
			}
2803
			while(0);
2804
			if( $_461 === FALSE) {
2805
				$result = $res_462;
2806
				$this->pos = $pos_462;
2807
				unset( $res_462 );
2808
				unset( $pos_462 );
2809
			}
2810
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2811
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
2812
			else { $_492 = FALSE; break; }
2813
			while (true) {
2814
				$res_475 = $result;
2815
				$pos_475 = $this->pos;
2816
				$_474 = NULL;
0 ignored issues
show
Unused Code introduced by
$_474 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2817 View Code Duplication
				do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2818
					$_472 = NULL;
0 ignored issues
show
Unused Code introduced by
$_472 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2819
					do {
2820
						$res_465 = $result;
2821
						$pos_465 = $this->pos;
2822
						$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
2823
						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2824
						if ($subres !== FALSE) {
2825
							$this->store( $result, $subres );
2826
							$_472 = TRUE; break;
2827
						}
2828
						$result = $res_465;
2829
						$this->pos = $pos_465;
2830
						$_470 = NULL;
0 ignored issues
show
Unused Code introduced by
$_470 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2831
						do {
2832
							$res_467 = $result;
2833
							$pos_467 = $this->pos;
2834
							$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
2835
							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2836
							if ($subres !== FALSE) {
2837
								$this->store( $result, $subres );
2838
								$_470 = TRUE; break;
2839
							}
2840
							$result = $res_467;
2841
							$this->pos = $pos_467;
2842
							$matcher = 'match_'.'CacheBlockTemplate'; $key = $matcher; $pos = $this->pos;
2843
							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2844
							if ($subres !== FALSE) {
2845
								$this->store( $result, $subres );
2846
								$_470 = TRUE; break;
2847
							}
2848
							$result = $res_467;
2849
							$this->pos = $pos_467;
2850
							$_470 = FALSE; break;
2851
						}
2852
						while(0);
2853
						if( $_470 === TRUE ) { $_472 = TRUE; break; }
2854
						$result = $res_465;
2855
						$this->pos = $pos_465;
2856
						$_472 = FALSE; break;
2857
					}
2858
					while(0);
2859
					if( $_472 === FALSE) { $_474 = FALSE; break; }
2860
					$_474 = TRUE; break;
2861
				}
2862
				while(0);
2863
				if( $_474 === FALSE) {
2864
					$result = $res_475;
2865
					$this->pos = $pos_475;
2866
					unset( $res_475 );
2867
					unset( $pos_475 );
2868
					break;
2869
				}
2870
			}
2871
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
2872
			else { $_492 = FALSE; break; }
2873
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2874
			if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
2875
			else { $_492 = FALSE; break; }
2876
			$_488 = NULL;
0 ignored issues
show
Unused Code introduced by
$_488 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2877 View Code Duplication
			do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2878
				$_486 = NULL;
0 ignored issues
show
Unused Code introduced by
$_486 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2879
				do {
2880
					$res_479 = $result;
2881
					$pos_479 = $this->pos;
2882
					if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
2883
						$result["text"] .= $subres;
2884
						$_486 = TRUE; break;
2885
					}
2886
					$result = $res_479;
2887
					$this->pos = $pos_479;
2888
					$_484 = NULL;
0 ignored issues
show
Unused Code introduced by
$_484 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2889
					do {
2890
						$res_481 = $result;
2891
						$pos_481 = $this->pos;
2892
						if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
2893
							$result["text"] .= $subres;
2894
							$_484 = TRUE; break;
2895
						}
2896
						$result = $res_481;
2897
						$this->pos = $pos_481;
2898
						if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
2899
							$result["text"] .= $subres;
2900
							$_484 = TRUE; break;
2901
						}
2902
						$result = $res_481;
2903
						$this->pos = $pos_481;
2904
						$_484 = FALSE; break;
2905
					}
2906
					while(0);
2907
					if( $_484 === TRUE ) { $_486 = TRUE; break; }
2908
					$result = $res_479;
2909
					$this->pos = $pos_479;
2910
					$_486 = FALSE; break;
2911
				}
2912
				while(0);
2913
				if( $_486 === FALSE) { $_488 = FALSE; break; }
2914
				$_488 = TRUE; break;
2915
			}
2916
			while(0);
2917
			if( $_488 === FALSE) { $_492 = FALSE; break; }
2918
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2919
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
2920
			else { $_492 = FALSE; break; }
2921
			$_492 = TRUE; break;
2922
		}
2923
		while(0);
2924
		if( $_492 === TRUE ) { return $this->finalise($result); }
2925
		if( $_492 === FALSE) { return FALSE; }
2926
	}
2927
2928
2929
2930
	function CacheBlock__construct(&$res){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
2931
		$res['subblocks'] = 0;
2932
	}
2933
	
2934
	function CacheBlock_CacheBlockArguments(&$res, $sub){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
2935
		$res['key'] = !empty($sub['php']) ? $sub['php'] : '';
2936
	}
2937
	
2938
	function CacheBlock_Condition(&$res, $sub){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
2939
		$res['condition'] = ($res['Conditional']['text'] == 'if' ? '(' : '!(') . $sub['php'] . ') && ';
2940
	}
2941
	
2942
	function CacheBlock_CacheBlock(&$res, $sub){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
2943
		$res['php'] .= $sub['php'];
2944
	}
2945
	
2946
	function CacheBlock_UncachedBlock(&$res, $sub){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
2947
		$res['php'] .= $sub['php'];
2948
	}
2949
	
2950 View Code Duplication
	function CacheBlock_CacheBlockTemplate(&$res, $sub){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
2951
		// Get the block counter
2952
		$block = ++$res['subblocks'];
2953
		// Build the key for this block from the global key (evaluated in a closure within the template),
2954
		// the passed cache key, the block index, and the sha hash of the template.
2955
		$res['php'] .= '$keyExpression = function() use ($scope, $cache) {' . PHP_EOL;
2956
		$res['php'] .= '$val = \'\';' . PHP_EOL;
2957
		if($globalKey = Config::inst()->get('SSViewer', 'global_key')) {
2958
			// Embed the code necessary to evaluate the globalKey directly into the template,
2959
			// so that SSTemplateParser only needs to be called during template regeneration.
2960
			// Warning: If the global key is changed, it's necessary to flush the template cache.
2961
			$parser = Injector::inst()->get('SSTemplateParser', false);
2962
			$result = $parser->compileString($globalKey, '', false, false);
2963
			if(!$result) throw new SSTemplateParseException('Unexpected problem parsing template', $parser);
2964
			$res['php'] .= $result . PHP_EOL;
2965
		}
2966
		$res['php'] .= 'return $val;' . PHP_EOL;
2967
		$res['php'] .= '};' . PHP_EOL;
2968
		$key = 'sha1($keyExpression())' // Global key
2969
			. '.\'_' . sha1($sub['php']) // sha of template
2970
			. (isset($res['key']) && $res['key'] ? "_'.sha1(".$res['key'].")" : "'") // Passed key
2971
			. ".'_$block'"; // block index
2972
		// Get any condition
2973
		$condition = isset($res['condition']) ? $res['condition'] : '';
2974
		
2975
		$res['php'] .= 'if ('.$condition.'($partial = $cache->load('.$key.'))) $val .= $partial;' . PHP_EOL;
2976
		$res['php'] .= 'else { $oldval = $val; $val = "";' . PHP_EOL;
2977
		$res['php'] .= $sub['php'] . PHP_EOL;
2978
		$res['php'] .= $condition . ' $cache->save($val); $val = $oldval . $val;' . PHP_EOL;
2979
		$res['php'] .= '}';
2980
	}
2981
	
2982
	/* OldTPart: "_t" N "(" N QuotedString (N "," N CallArguments)? N ")" N (";")? */
2983
	protected $match_OldTPart_typestack = array('OldTPart');
2984
	function match_OldTPart ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
2985
		$matchrule = "OldTPart"; $result = $this->construct($matchrule, $matchrule, null);
2986
		$_511 = NULL;
0 ignored issues
show
Unused Code introduced by
$_511 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
2987
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
2988
			if (( $subres = $this->literal( '_t' ) ) !== FALSE) { $result["text"] .= $subres; }
2989
			else { $_511 = FALSE; break; }
2990
			$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
2991
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2992
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
2993
			else { $_511 = FALSE; break; }
2994
			if (substr($this->string,$this->pos,1) == '(') {
2995
				$this->pos += 1;
2996
				$result["text"] .= '(';
2997
			}
2998
			else { $_511 = FALSE; break; }
2999
			$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
3000
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3001
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
3002
			else { $_511 = FALSE; break; }
3003
			$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
3004
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3005
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
3006
			else { $_511 = FALSE; break; }
3007
			$res_504 = $result;
3008
			$pos_504 = $this->pos;
3009
			$_503 = NULL;
0 ignored issues
show
Unused Code introduced by
$_503 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3010
			do {
3011
				$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
3012
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3013
				if ($subres !== FALSE) { $this->store( $result, $subres ); }
3014
				else { $_503 = FALSE; break; }
3015
				if (substr($this->string,$this->pos,1) == ',') {
3016
					$this->pos += 1;
3017
					$result["text"] .= ',';
3018
				}
3019
				else { $_503 = FALSE; break; }
3020
				$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
3021
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3022
				if ($subres !== FALSE) { $this->store( $result, $subres ); }
3023
				else { $_503 = FALSE; break; }
3024
				$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
3025
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3026
				if ($subres !== FALSE) { $this->store( $result, $subres ); }
3027
				else { $_503 = FALSE; break; }
3028
				$_503 = TRUE; break;
3029
			}
3030
			while(0);
3031
			if( $_503 === FALSE) {
3032
				$result = $res_504;
3033
				$this->pos = $pos_504;
3034
				unset( $res_504 );
3035
				unset( $pos_504 );
3036
			}
3037
			$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
3038
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3039
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
3040
			else { $_511 = FALSE; break; }
3041
			if (substr($this->string,$this->pos,1) == ')') {
3042
				$this->pos += 1;
3043
				$result["text"] .= ')';
3044
			}
3045
			else { $_511 = FALSE; break; }
3046
			$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
3047
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3048
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
3049
			else { $_511 = FALSE; break; }
3050
			$res_510 = $result;
3051
			$pos_510 = $this->pos;
3052
			$_509 = NULL;
0 ignored issues
show
Unused Code introduced by
$_509 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3053
			do {
3054
				if (substr($this->string,$this->pos,1) == ';') {
3055
					$this->pos += 1;
3056
					$result["text"] .= ';';
3057
				}
3058
				else { $_509 = FALSE; break; }
3059
				$_509 = TRUE; break;
3060
			}
3061
			while(0);
3062
			if( $_509 === FALSE) {
3063
				$result = $res_510;
3064
				$this->pos = $pos_510;
3065
				unset( $res_510 );
3066
				unset( $pos_510 );
3067
			}
3068
			$_511 = TRUE; break;
3069
		}
3070
		while(0);
3071
		if( $_511 === TRUE ) { return $this->finalise($result); }
3072
		if( $_511 === FALSE) { return FALSE; }
3073
	}
3074
3075
3076
	/* N: / [\s\n]* / */
3077
	protected $match_N_typestack = array('N');
3078 View Code Duplication
	function match_N ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3079
		$matchrule = "N"; $result = $this->construct($matchrule, $matchrule, null);
3080
		if (( $subres = $this->rx( '/ [\s\n]* /' ) ) !== FALSE) {
3081
			$result["text"] .= $subres;
3082
			return $this->finalise($result);
3083
		}
3084
		else { return FALSE; }
3085
	}
3086
3087
3088
3089
	function OldTPart__construct(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3090
		$res['php'] = "_t(";
3091
	}
3092
	
3093 View Code Duplication
	function OldTPart_QuotedString(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3094
		$entity = $sub['String']['text'];
3095
		if (strpos($entity, '.') === false) {
3096
			$res['php'] .= "\$scope->XML_val('I18NNamespace').'.$entity'";
3097
		}
3098
		else {
3099
			$res['php'] .= "'$entity'";
3100
		}
3101
	}
3102
	
3103
	function OldTPart_CallArguments(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3104
		$res['php'] .= ',' . $sub['php'];
3105
	}
3106
3107
	function OldTPart__finalise(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3108
		$res['php'] .= ')';
3109
	}
3110
	
3111
	/* OldTTag: "<%" < OldTPart > "%>" */
3112
	protected $match_OldTTag_typestack = array('OldTTag');
3113
	function match_OldTTag ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3114
		$matchrule = "OldTTag"; $result = $this->construct($matchrule, $matchrule, null);
3115
		$_519 = NULL;
0 ignored issues
show
Unused Code introduced by
$_519 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3116
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
3117
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
3118
			else { $_519 = FALSE; break; }
3119
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3120
			$matcher = 'match_'.'OldTPart'; $key = $matcher; $pos = $this->pos;
3121
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3122
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
3123
			else { $_519 = FALSE; break; }
3124
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3125
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
3126
			else { $_519 = FALSE; break; }
3127
			$_519 = TRUE; break;
3128
		}
3129
		while(0);
3130
		if( $_519 === TRUE ) { return $this->finalise($result); }
3131
		if( $_519 === FALSE) { return FALSE; }
3132
	}
3133
3134
3135
3136
	function OldTTag_OldTPart(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3137
		$res['php'] = $sub['php'];
3138
	}
3139
3140
	/* OldSprintfTag: "<%" < "sprintf" < "(" < OldTPart < "," < CallArguments > ")" > "%>"  */
3141
	protected $match_OldSprintfTag_typestack = array('OldSprintfTag');
3142
	function match_OldSprintfTag ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3143
		$matchrule = "OldSprintfTag"; $result = $this->construct($matchrule, $matchrule, null);
3144
		$_536 = NULL;
0 ignored issues
show
Unused Code introduced by
$_536 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3145
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
3146
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
3147
			else { $_536 = FALSE; break; }
3148
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3149
			if (( $subres = $this->literal( 'sprintf' ) ) !== FALSE) { $result["text"] .= $subres; }
3150
			else { $_536 = FALSE; break; }
3151
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3152
			if (substr($this->string,$this->pos,1) == '(') {
3153
				$this->pos += 1;
3154
				$result["text"] .= '(';
3155
			}
3156
			else { $_536 = FALSE; break; }
3157
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3158
			$matcher = 'match_'.'OldTPart'; $key = $matcher; $pos = $this->pos;
3159
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3160
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
3161
			else { $_536 = FALSE; break; }
3162
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3163
			if (substr($this->string,$this->pos,1) == ',') {
3164
				$this->pos += 1;
3165
				$result["text"] .= ',';
3166
			}
3167
			else { $_536 = FALSE; break; }
3168
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3169
			$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
3170
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3171
			if ($subres !== FALSE) { $this->store( $result, $subres ); }
3172
			else { $_536 = FALSE; break; }
3173
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3174
			if (substr($this->string,$this->pos,1) == ')') {
3175
				$this->pos += 1;
3176
				$result["text"] .= ')';
3177
			}
3178
			else { $_536 = FALSE; break; }
3179
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3180
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
3181
			else { $_536 = FALSE; break; }
3182
			$_536 = TRUE; break;
3183
		}
3184
		while(0);
3185
		if( $_536 === TRUE ) { return $this->finalise($result); }
3186
		if( $_536 === FALSE) { return FALSE; }
3187
	}
3188
3189
3190
3191
	function OldSprintfTag__construct(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3192
		$res['php'] = "sprintf(";
3193
	}
3194
	
3195
	function OldSprintfTag_OldTPart(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3196
		$res['php'] .= $sub['php'];
3197
	}
3198
3199
	function OldSprintfTag_CallArguments(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3200
		$res['php'] .= ',' . $sub['php'] . ')';
3201
	}
3202
	
3203
	/* OldI18NTag: OldSprintfTag | OldTTag */
3204
	protected $match_OldI18NTag_typestack = array('OldI18NTag');
3205 View Code Duplication
	function match_OldI18NTag ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3206
		$matchrule = "OldI18NTag"; $result = $this->construct($matchrule, $matchrule, null);
3207
		$_541 = NULL;
0 ignored issues
show
Unused Code introduced by
$_541 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3208
		do {
0 ignored issues
show
Unused Code introduced by
do { $res_538 = $res... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
3209
			$res_538 = $result;
3210
			$pos_538 = $this->pos;
3211
			$matcher = 'match_'.'OldSprintfTag'; $key = $matcher; $pos = $this->pos;
3212
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3213
			if ($subres !== FALSE) {
3214
				$this->store( $result, $subres );
3215
				$_541 = TRUE; break;
3216
			}
3217
			$result = $res_538;
3218
			$this->pos = $pos_538;
3219
			$matcher = 'match_'.'OldTTag'; $key = $matcher; $pos = $this->pos;
3220
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3221
			if ($subres !== FALSE) {
3222
				$this->store( $result, $subres );
3223
				$_541 = TRUE; break;
3224
			}
3225
			$result = $res_538;
3226
			$this->pos = $pos_538;
3227
			$_541 = FALSE; break;
3228
		}
3229
		while(0);
3230
		if( $_541 === TRUE ) { return $this->finalise($result); }
3231
		if( $_541 === FALSE) { return FALSE; }
3232
	}
3233
3234
3235
3236
	function OldI18NTag_STR(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3237
		$res['php'] = '$val .= ' . $sub['php'] . ';';
3238
	}
3239
3240
	/* NamedArgument: Name:Word "=" Value:Argument */
3241
	protected $match_NamedArgument_typestack = array('NamedArgument');
3242
	function match_NamedArgument ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3243
		$matchrule = "NamedArgument"; $result = $this->construct($matchrule, $matchrule, null);
3244
		$_546 = NULL;
0 ignored issues
show
Unused Code introduced by
$_546 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3245
		do {
0 ignored issues
show
Unused Code introduced by
do { $matcher = 'mat... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
3246
			$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
3247
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3248
			if ($subres !== FALSE) {
3249
				$this->store( $result, $subres, "Name" );
3250
			}
3251
			else { $_546 = FALSE; break; }
3252
			if (substr($this->string,$this->pos,1) == '=') {
3253
				$this->pos += 1;
3254
				$result["text"] .= '=';
3255
			}
3256
			else { $_546 = FALSE; break; }
3257
			$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
3258
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3259
			if ($subres !== FALSE) {
3260
				$this->store( $result, $subres, "Value" );
3261
			}
3262
			else { $_546 = FALSE; break; }
3263
			$_546 = TRUE; break;
3264
		}
3265
		while(0);
3266
		if( $_546 === TRUE ) { return $this->finalise($result); }
3267
		if( $_546 === FALSE) { return FALSE; }
3268
	}
3269
3270
3271
3272
	function NamedArgument_Name(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3273
		$res['php'] = "'" . $sub['text'] . "' => ";
3274
	}
3275
3276 View Code Duplication
	function NamedArgument_Value(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3277
		switch($sub['ArgumentMode']) {
3278
			case 'string':
3279
				$res['php'] .= $sub['php'];
3280
				break;
3281
3282
			case 'default':
3283
				$res['php'] .= $sub['string_php'];
3284
				break;
3285
3286
			default:
3287
				$res['php'] .= str_replace('$$FINAL', 'obj', $sub['php']) . '->self()';
3288
				break;
3289
		}
3290
	}
3291
3292
	/* Include: "<%" < "include" < Template:NamespacedWord < (NamedArgument ( < "," < NamedArgument )*)? > "%>" */
3293
	protected $match_Include_typestack = array('Include');
3294
	function match_Include ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3295
		$matchrule = "Include"; $result = $this->construct($matchrule, $matchrule, null);
3296
		$_565 = NULL;
0 ignored issues
show
Unused Code introduced by
$_565 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3297
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
3298
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
3299
			else { $_565 = FALSE; break; }
3300
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3301
			if (( $subres = $this->literal( 'include' ) ) !== FALSE) { $result["text"] .= $subres; }
3302
			else { $_565 = FALSE; break; }
3303
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3304
			$matcher = 'match_'.'NamespacedWord'; $key = $matcher; $pos = $this->pos;
3305
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3306
			if ($subres !== FALSE) {
3307
				$this->store( $result, $subres, "Template" );
3308
			}
3309
			else { $_565 = FALSE; break; }
3310
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3311
			$res_562 = $result;
3312
			$pos_562 = $this->pos;
3313
			$_561 = NULL;
0 ignored issues
show
Unused Code introduced by
$_561 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3314
			do {
3315
				$matcher = 'match_'.'NamedArgument'; $key = $matcher; $pos = $this->pos;
3316
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3317
				if ($subres !== FALSE) { $this->store( $result, $subres ); }
3318
				else { $_561 = FALSE; break; }
3319
				while (true) {
3320
					$res_560 = $result;
3321
					$pos_560 = $this->pos;
3322
					$_559 = NULL;
0 ignored issues
show
Unused Code introduced by
$_559 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3323
					do {
3324
						if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3325
						if (substr($this->string,$this->pos,1) == ',') {
3326
							$this->pos += 1;
3327
							$result["text"] .= ',';
3328
						}
3329
						else { $_559 = FALSE; break; }
3330
						if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3331
						$matcher = 'match_'.'NamedArgument'; $key = $matcher; $pos = $this->pos;
3332
						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3333
						if ($subres !== FALSE) {
3334
							$this->store( $result, $subres );
3335
						}
3336
						else { $_559 = FALSE; break; }
3337
						$_559 = TRUE; break;
3338
					}
3339
					while(0);
3340
					if( $_559 === FALSE) {
3341
						$result = $res_560;
3342
						$this->pos = $pos_560;
3343
						unset( $res_560 );
3344
						unset( $pos_560 );
3345
						break;
3346
					}
3347
				}
3348
				$_561 = TRUE; break;
3349
			}
3350
			while(0);
3351
			if( $_561 === FALSE) {
3352
				$result = $res_562;
3353
				$this->pos = $pos_562;
3354
				unset( $res_562 );
3355
				unset( $pos_562 );
3356
			}
3357
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3358
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
3359
			else { $_565 = FALSE; break; }
3360
			$_565 = TRUE; break;
3361
		}
3362
		while(0);
3363
		if( $_565 === TRUE ) { return $this->finalise($result); }
3364
		if( $_565 === FALSE) { return FALSE; }
3365
	}
3366
3367
3368
3369
	function Include__construct(&$res){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3370
		$res['arguments'] = array();
3371
	}
3372
3373
	function Include_Template(&$res, $sub){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3374
		$res['template'] = "'" . $sub['text'] . "'";
3375
	}
3376
3377
	function Include_NamedArgument(&$res, $sub){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3378
		$res['arguments'][] = $sub['php'];
3379
	}
3380
3381 View Code Duplication
	function Include__finalise(&$res){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3382
		$template = $res['template'];
3383
		$arguments = $res['arguments'];
3384
3385
		$res['php'] = '$val .= SSViewer::execute_template('.$template.', $scope->getItem(), array(' . 
3386
			implode(',', $arguments)."), \$scope);\n";
3387
3388
		if($this->includeDebuggingComments) { // Add include filename comments on dev sites
3389
			$res['php'] =
3390
				'$val .= \'<!-- include '.addslashes($template).' -->\';'. "\n".
3391
				$res['php'].
3392
				'$val .= \'<!-- end include '.addslashes($template).' -->\';'. "\n";
3393
		}
3394
	}
3395
3396
	/* BlockArguments: :Argument ( < "," < :Argument)*  */
3397
	protected $match_BlockArguments_typestack = array('BlockArguments');
3398 View Code Duplication
	function match_BlockArguments ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3399
		$matchrule = "BlockArguments"; $result = $this->construct($matchrule, $matchrule, null);
3400
		$_574 = NULL;
0 ignored issues
show
Unused Code introduced by
$_574 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3401
		do {
0 ignored issues
show
Unused Code introduced by
do { $matcher = 'mat... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
3402
			$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
3403
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3404
			if ($subres !== FALSE) {
3405
				$this->store( $result, $subres, "Argument" );
3406
			}
3407
			else { $_574 = FALSE; break; }
3408
			while (true) {
3409
				$res_573 = $result;
3410
				$pos_573 = $this->pos;
3411
				$_572 = NULL;
0 ignored issues
show
Unused Code introduced by
$_572 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3412
				do {
3413
					if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3414
					if (substr($this->string,$this->pos,1) == ',') {
3415
						$this->pos += 1;
3416
						$result["text"] .= ',';
3417
					}
3418
					else { $_572 = FALSE; break; }
3419
					if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3420
					$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
3421
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3422
					if ($subres !== FALSE) {
3423
						$this->store( $result, $subres, "Argument" );
3424
					}
3425
					else { $_572 = FALSE; break; }
3426
					$_572 = TRUE; break;
3427
				}
3428
				while(0);
3429
				if( $_572 === FALSE) {
3430
					$result = $res_573;
3431
					$this->pos = $pos_573;
3432
					unset( $res_573 );
3433
					unset( $pos_573 );
3434
					break;
3435
				}
3436
			}
3437
			$_574 = TRUE; break;
3438
		}
3439
		while(0);
3440
		if( $_574 === TRUE ) { return $this->finalise($result); }
3441
		if( $_574 === FALSE) { return FALSE; }
3442
	}
3443
3444
3445
	/* NotBlockTag: "end_" | (("if" | "else_if" | "else" | "require" | "cached" | "uncached" | "cacheblock" | "include")]) */
3446
	protected $match_NotBlockTag_typestack = array('NotBlockTag');
3447
	function match_NotBlockTag ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3448
		$matchrule = "NotBlockTag"; $result = $this->construct($matchrule, $matchrule, null);
3449
		$_612 = NULL;
0 ignored issues
show
Unused Code introduced by
$_612 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3450
		do {
0 ignored issues
show
Unused Code introduced by
do { $res_576 = $res... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
3451
			$res_576 = $result;
3452
			$pos_576 = $this->pos;
3453
			if (( $subres = $this->literal( 'end_' ) ) !== FALSE) {
3454
				$result["text"] .= $subres;
3455
				$_612 = TRUE; break;
3456
			}
3457
			$result = $res_576;
3458
			$this->pos = $pos_576;
3459
			$_610 = NULL;
0 ignored issues
show
Unused Code introduced by
$_610 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3460
			do {
3461
				$_607 = NULL;
0 ignored issues
show
Unused Code introduced by
$_607 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3462
				do {
3463
					$_605 = NULL;
0 ignored issues
show
Unused Code introduced by
$_605 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3464
					do {
3465
						$res_578 = $result;
3466
						$pos_578 = $this->pos;
3467
						if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
3468
							$result["text"] .= $subres;
3469
							$_605 = TRUE; break;
3470
						}
3471
						$result = $res_578;
3472
						$this->pos = $pos_578;
3473
						$_603 = NULL;
0 ignored issues
show
Unused Code introduced by
$_603 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3474
						do {
3475
							$res_580 = $result;
3476
							$pos_580 = $this->pos;
3477
							if (( $subres = $this->literal( 'else_if' ) ) !== FALSE) {
3478
								$result["text"] .= $subres;
3479
								$_603 = TRUE; break;
3480
							}
3481
							$result = $res_580;
3482
							$this->pos = $pos_580;
3483
							$_601 = NULL;
0 ignored issues
show
Unused Code introduced by
$_601 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3484
							do {
3485
								$res_582 = $result;
3486
								$pos_582 = $this->pos;
3487
								if (( $subres = $this->literal( 'else' ) ) !== FALSE) {
3488
									$result["text"] .= $subres;
3489
									$_601 = TRUE; break;
3490
								}
3491
								$result = $res_582;
3492
								$this->pos = $pos_582;
3493
								$_599 = NULL;
0 ignored issues
show
Unused Code introduced by
$_599 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3494
								do {
3495
									$res_584 = $result;
3496
									$pos_584 = $this->pos;
3497
									if (( $subres = $this->literal( 'require' ) ) !== FALSE) {
3498
										$result["text"] .= $subres;
3499
										$_599 = TRUE; break;
3500
									}
3501
									$result = $res_584;
3502
									$this->pos = $pos_584;
3503
									$_597 = NULL;
0 ignored issues
show
Unused Code introduced by
$_597 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3504
									do {
3505
										$res_586 = $result;
3506
										$pos_586 = $this->pos;
3507
										if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
3508
											$result["text"] .= $subres;
3509
											$_597 = TRUE; break;
3510
										}
3511
										$result = $res_586;
3512
										$this->pos = $pos_586;
3513
										$_595 = NULL;
0 ignored issues
show
Unused Code introduced by
$_595 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3514
										do {
3515
											$res_588 = $result;
3516
											$pos_588 = $this->pos;
3517
											if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
3518
												$result["text"] .= $subres;
3519
												$_595 = TRUE; break;
3520
											}
3521
											$result = $res_588;
3522
											$this->pos = $pos_588;
3523
											$_593 = NULL;
0 ignored issues
show
Unused Code introduced by
$_593 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3524
											do {
3525
												$res_590 = $result;
3526
												$pos_590 = $this->pos;
3527
												if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
3528
													$result["text"] .= $subres;
3529
													$_593 = TRUE; break;
3530
												}
3531
												$result = $res_590;
3532
												$this->pos = $pos_590;
3533
												if (( $subres = $this->literal( 'include' ) ) !== FALSE) {
3534
													$result["text"] .= $subres;
3535
													$_593 = TRUE; break;
3536
												}
3537
												$result = $res_590;
3538
												$this->pos = $pos_590;
3539
												$_593 = FALSE; break;
3540
											}
3541
											while(0);
3542
											if( $_593 === TRUE ) { $_595 = TRUE; break; }
3543
											$result = $res_588;
3544
											$this->pos = $pos_588;
3545
											$_595 = FALSE; break;
3546
										}
3547
										while(0);
3548
										if( $_595 === TRUE ) { $_597 = TRUE; break; }
3549
										$result = $res_586;
3550
										$this->pos = $pos_586;
3551
										$_597 = FALSE; break;
3552
									}
3553
									while(0);
3554
									if( $_597 === TRUE ) { $_599 = TRUE; break; }
3555
									$result = $res_584;
3556
									$this->pos = $pos_584;
3557
									$_599 = FALSE; break;
3558
								}
3559
								while(0);
3560
								if( $_599 === TRUE ) { $_601 = TRUE; break; }
3561
								$result = $res_582;
3562
								$this->pos = $pos_582;
3563
								$_601 = FALSE; break;
3564
							}
3565
							while(0);
3566
							if( $_601 === TRUE ) { $_603 = TRUE; break; }
3567
							$result = $res_580;
3568
							$this->pos = $pos_580;
3569
							$_603 = FALSE; break;
3570
						}
3571
						while(0);
3572
						if( $_603 === TRUE ) { $_605 = TRUE; break; }
3573
						$result = $res_578;
3574
						$this->pos = $pos_578;
3575
						$_605 = FALSE; break;
3576
					}
3577
					while(0);
3578
					if( $_605 === FALSE) { $_607 = FALSE; break; }
3579
					$_607 = TRUE; break;
3580
				}
3581
				while(0);
3582
				if( $_607 === FALSE) { $_610 = FALSE; break; }
3583
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3584
				else { $_610 = FALSE; break; }
3585
				$_610 = TRUE; break;
3586
			}
3587
			while(0);
3588
			if( $_610 === TRUE ) { $_612 = TRUE; break; }
3589
			$result = $res_576;
3590
			$this->pos = $pos_576;
3591
			$_612 = FALSE; break;
3592
		}
3593
		while(0);
3594
		if( $_612 === TRUE ) { return $this->finalise($result); }
3595
		if( $_612 === FALSE) { return FALSE; }
3596
	}
3597
3598
3599
	/* ClosedBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > Zap:'%>' Template:$TemplateMatcher? 
3600
	'<%' < 'end_' '$BlockName' > '%>' */
3601
	protected $match_ClosedBlock_typestack = array('ClosedBlock');
3602
	function match_ClosedBlock ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3603
		$matchrule = "ClosedBlock"; $result = $this->construct($matchrule, $matchrule, null);
3604
		$_632 = NULL;
0 ignored issues
show
Unused Code introduced by
$_632 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3605
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
3606
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
3607
			else { $_632 = FALSE; break; }
3608
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3609
			$res_616 = $result;
3610
			$pos_616 = $this->pos;
3611
			$matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos;
3612
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3613 View Code Duplication
			if ($subres !== FALSE) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3614
				$this->store( $result, $subres );
3615
				$result = $res_616;
3616
				$this->pos = $pos_616;
3617
				$_632 = FALSE; break;
3618
			}
3619
			else {
3620
				$result = $res_616;
3621
				$this->pos = $pos_616;
3622
			}
3623
			$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
3624
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3625
			if ($subres !== FALSE) {
3626
				$this->store( $result, $subres, "BlockName" );
3627
			}
3628
			else { $_632 = FALSE; break; }
3629
			$res_622 = $result;
3630
			$pos_622 = $this->pos;
3631
			$_621 = NULL;
0 ignored issues
show
Unused Code introduced by
$_621 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3632 View Code Duplication
			do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3633
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3634
				else { $_621 = FALSE; break; }
3635
				$matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos;
3636
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3637
				if ($subres !== FALSE) {
3638
					$this->store( $result, $subres, "BlockArguments" );
3639
				}
3640
				else { $_621 = FALSE; break; }
3641
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3642
				else { $_621 = FALSE; break; }
3643
				$_621 = TRUE; break;
3644
			}
3645
			while(0);
3646
			if( $_621 === FALSE) {
3647
				$result = $res_622;
3648
				$this->pos = $pos_622;
3649
				unset( $res_622 );
3650
				unset( $pos_622 );
3651
			}
3652
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3653
			$stack[] = $result; $result = $this->construct( $matchrule, "Zap" ); 
3654 View Code Duplication
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3655
				$result["text"] .= $subres;
3656
				$subres = $result; $result = array_pop($stack);
3657
				$this->store( $result, $subres, 'Zap' );
3658
			}
3659
			else {
3660
				$result = array_pop($stack);
3661
				$_632 = FALSE; break;
3662
			}
3663
			$res_625 = $result;
3664
			$pos_625 = $this->pos;
3665
			$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
3666
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3667
			if ($subres !== FALSE) {
3668
				$this->store( $result, $subres, "Template" );
3669
			}
3670
			else {
3671
				$result = $res_625;
3672
				$this->pos = $pos_625;
3673
				unset( $res_625 );
3674
				unset( $pos_625 );
3675
			}
3676
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
3677
			else { $_632 = FALSE; break; }
3678
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3679
			if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
3680
			else { $_632 = FALSE; break; }
3681 View Code Duplication
			if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'BlockName').'' ) ) !== FALSE) { $result["text"] .= $subres; }
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3682
			else { $_632 = FALSE; break; }
3683
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3684
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
3685
			else { $_632 = FALSE; break; }
3686
			$_632 = TRUE; break;
3687
		}
3688
		while(0);
3689
		if( $_632 === TRUE ) { return $this->finalise($result); }
3690
		if( $_632 === FALSE) { return FALSE; }
3691
	}
3692
3693
3694
3695
	
3696
	/**
3697
	 * As mentioned in the parser comment, block handling is kept fairly generic for extensibility. The match rule
3698
	 * builds up two important elements in the match result array:
3699
	 *   'ArgumentCount' - how many arguments were passed in the opening tag
3700
	 *   'Arguments' an array of the Argument match rule result arrays
3701
	 *
3702
	 * Once a block has successfully been matched against, it will then look for the actual handler, which should
3703
	 * be on this class (either defined or extended on) as ClosedBlock_Handler_Name(&$res), where Name is the
3704
	 * tag name, first letter captialized (i.e Control, Loop, With, etc).
3705
	 * 
3706
	 * This function will be called with the match rule result array as it's first argument. It should return
3707
	 * the php result of this block as it's return value, or throw an error if incorrect arguments were passed.
3708
	 */
3709
	
3710
	function ClosedBlock__construct(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3711
		$res['ArgumentCount'] = 0;
3712
	}
3713
	
3714 View Code Duplication
	function ClosedBlock_BlockArguments(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3715
		if (isset($sub['Argument']['ArgumentMode'])) {
3716
			$res['Arguments'] = array($sub['Argument']);
3717
			$res['ArgumentCount'] = 1;
3718
		}
3719
		else {
3720
			$res['Arguments'] = $sub['Argument'];
3721
			$res['ArgumentCount'] = count($res['Arguments']);
3722
		}
3723
	}
3724
3725 View Code Duplication
	function ClosedBlock__finalise(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3726
		$blockname = $res['BlockName']['text'];
3727
3728
		$method = 'ClosedBlock_Handle_'.$blockname;
3729
		if (method_exists($this, $method)) {
3730
			$res['php'] = $this->$method($res);
3731
		} else if (isset($this->closedBlocks[$blockname])) {
3732
			$res['php'] = call_user_func($this->closedBlocks[$blockname], $res);
3733
		} else {
3734
			throw new SSTemplateParseException('Unknown closed block "'.$blockname.'" encountered. Perhaps you are ' .
3735
			'not supposed to close this block, or have mis-spelled it?', $this);
3736
		}
3737
	}
3738
3739
	/**
3740
	 * This is an example of a block handler function. This one handles the loop tag.
3741
	 */
3742 View Code Duplication
	function ClosedBlock_Handle_Loop(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3743
		if ($res['ArgumentCount'] > 1) {
3744
			throw new SSTemplateParseException('Either no or too many arguments in control block. Must be one ' .
3745
				'argument only.', $this);
3746
		}
3747
3748
		//loop without arguments loops on the current scope
3749
		if ($res['ArgumentCount'] == 0) {
3750
			$on = '$scope->obj(\'Up\', null, true)->obj(\'Foo\', null, true)';
3751
		} else {    //loop in the normal way
3752
			$arg = $res['Arguments'][0];
3753
			if ($arg['ArgumentMode'] == 'string') {
3754
				throw new SSTemplateParseException('Control block cant take string as argument.', $this);
3755
			}
3756
			$on = str_replace('$$FINAL', 'obj', 
3757
				($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']);
3758
		}
3759
3760
		return
3761
			$on . '; $scope->pushScope(); while (($key = $scope->next()) !== false) {' . PHP_EOL .
3762
				$res['Template']['php'] . PHP_EOL .
3763
			'}; $scope->popScope(); ';
3764
	}
3765
3766
	/**
3767
	 * The closed block handler for with blocks
3768
	 */
3769 View Code Duplication
	function ClosedBlock_Handle_With(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3770
		if ($res['ArgumentCount'] != 1) {
3771
			throw new SSTemplateParseException('Either no or too many arguments in with block. Must be one ' .
3772
				'argument only.', $this);
3773
		}
3774
		
3775
		$arg = $res['Arguments'][0];
3776
		if ($arg['ArgumentMode'] == 'string') {
3777
			throw new SSTemplateParseException('Control block cant take string as argument.', $this);
3778
		}
3779
		
3780
		$on = str_replace('$$FINAL', 'obj', ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']);
3781
		return 
3782
			$on . '; $scope->pushScope();' . PHP_EOL .
3783
				$res['Template']['php'] . PHP_EOL .
3784
			'; $scope->popScope(); ';
3785
	}
3786
	
3787
	/* OpenBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > '%>' */
3788
	protected $match_OpenBlock_typestack = array('OpenBlock');
3789
	function match_OpenBlock ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3790
		$matchrule = "OpenBlock"; $result = $this->construct($matchrule, $matchrule, null);
3791
		$_645 = NULL;
0 ignored issues
show
Unused Code introduced by
$_645 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3792
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
3793
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
3794
			else { $_645 = FALSE; break; }
3795
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3796
			$res_636 = $result;
3797
			$pos_636 = $this->pos;
3798
			$matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos;
3799
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3800 View Code Duplication
			if ($subres !== FALSE) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3801
				$this->store( $result, $subres );
3802
				$result = $res_636;
3803
				$this->pos = $pos_636;
3804
				$_645 = FALSE; break;
3805
			}
3806
			else {
3807
				$result = $res_636;
3808
				$this->pos = $pos_636;
3809
			}
3810
			$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
3811
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3812
			if ($subres !== FALSE) {
3813
				$this->store( $result, $subres, "BlockName" );
3814
			}
3815
			else { $_645 = FALSE; break; }
3816
			$res_642 = $result;
3817
			$pos_642 = $this->pos;
3818
			$_641 = NULL;
0 ignored issues
show
Unused Code introduced by
$_641 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3819 View Code Duplication
			do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3820
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3821
				else { $_641 = FALSE; break; }
3822
				$matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos;
3823
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3824
				if ($subres !== FALSE) {
3825
					$this->store( $result, $subres, "BlockArguments" );
3826
				}
3827
				else { $_641 = FALSE; break; }
3828
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3829
				else { $_641 = FALSE; break; }
3830
				$_641 = TRUE; break;
3831
			}
3832
			while(0);
3833
			if( $_641 === FALSE) {
3834
				$result = $res_642;
3835
				$this->pos = $pos_642;
3836
				unset( $res_642 );
3837
				unset( $pos_642 );
3838
			}
3839
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3840
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
3841
			else { $_645 = FALSE; break; }
3842
			$_645 = TRUE; break;
3843
		}
3844
		while(0);
3845
		if( $_645 === TRUE ) { return $this->finalise($result); }
3846
		if( $_645 === FALSE) { return FALSE; }
3847
	}
3848
3849
3850
3851
	function OpenBlock__construct(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3852
		$res['ArgumentCount'] = 0;
3853
	}
3854
	
3855 View Code Duplication
	function OpenBlock_BlockArguments(&$res, $sub) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3856
		if (isset($sub['Argument']['ArgumentMode'])) {
3857
			$res['Arguments'] = array($sub['Argument']);
3858
			$res['ArgumentCount'] = 1;
3859
		}
3860
		else {
3861
			$res['Arguments'] = $sub['Argument'];
3862
			$res['ArgumentCount'] = count($res['Arguments']);
3863
		}
3864
	}
3865
3866 View Code Duplication
	function OpenBlock__finalise(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3867
		$blockname = $res['BlockName']['text'];
3868
3869
		$method = 'OpenBlock_Handle_'.$blockname;
3870
		if (method_exists($this, $method)) {
3871
			$res['php'] = $this->$method($res);
3872
		} elseif (isset($this->openBlocks[$blockname])) {
3873
			$res['php'] = call_user_func($this->openBlocks[$blockname], $res);
3874
		} else {
3875
			throw new SSTemplateParseException('Unknown open block "'.$blockname.'" encountered. Perhaps you missed ' .
3876
			' the closing tag or have mis-spelled it?', $this);
3877
		}
3878
	}
3879
3880
	/**
3881
	 * This is an open block handler, for the <% debug %> utility tag
3882
	 */
3883 View Code Duplication
	function OpenBlock_Handle_Debug(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3884
		if ($res['ArgumentCount'] == 0) return '$scope->debug();';
3885
		else if ($res['ArgumentCount'] == 1) {
3886
			$arg = $res['Arguments'][0];
3887
			
3888
			if ($arg['ArgumentMode'] == 'string') return 'Debug::show('.$arg['php'].');';
3889
			
3890
			$php = ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php'];
3891
			return '$val .= Debug::show('.str_replace('FINALGET!', 'cachedCall', $php).');';
3892
		}
3893
		else {
3894
			throw new SSTemplateParseException('Debug takes 0 or 1 argument only.', $this);
3895
		}
3896
	}
3897
3898
	/**
3899
	 * This is an open block handler, for the <% base_tag %> tag
3900
	 */
3901
	function OpenBlock_Handle_Base_tag(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3902
		if ($res['ArgumentCount'] != 0) throw new SSTemplateParseException('Base_tag takes no arguments', $this);
3903
		return '$val .= SSViewer::get_base_tag($val);';
3904
	}
3905
3906
	/**
3907
	 * This is an open block handler, for the <% current_page %> tag
3908
	 */
3909
	function OpenBlock_Handle_Current_page(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3910
		if ($res['ArgumentCount'] != 0) throw new SSTemplateParseException('Current_page takes no arguments', $this);
3911
		return '$val .= $_SERVER[SCRIPT_URL];';
3912
	}
3913
	
3914
	/* MismatchedEndBlock: '<%' < 'end_' :Word > '%>' */
3915
	protected $match_MismatchedEndBlock_typestack = array('MismatchedEndBlock');
3916
	function match_MismatchedEndBlock ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3917
		$matchrule = "MismatchedEndBlock"; $result = $this->construct($matchrule, $matchrule, null);
3918
		$_653 = NULL;
0 ignored issues
show
Unused Code introduced by
$_653 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3919
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
3920
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
3921
			else { $_653 = FALSE; break; }
3922
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3923
			if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
3924
			else { $_653 = FALSE; break; }
3925
			$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
3926
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3927
			if ($subres !== FALSE) {
3928
				$this->store( $result, $subres, "Word" );
3929
			}
3930
			else { $_653 = FALSE; break; }
3931
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3932
			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
3933
			else { $_653 = FALSE; break; }
3934
			$_653 = TRUE; break;
3935
		}
3936
		while(0);
3937
		if( $_653 === TRUE ) { return $this->finalise($result); }
3938
		if( $_653 === FALSE) { return FALSE; }
3939
	}
3940
3941
3942
3943
	function MismatchedEndBlock__finalise(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3944
		$blockname = $res['Word']['text'];
3945
		throw new SSTemplateParseException('Unexpected close tag end_' . $blockname . 
3946
			' encountered. Perhaps you have mis-nested blocks, or have mis-spelled a tag?', $this);
3947
	}
3948
3949
	/* MalformedOpenTag: '<%' < !NotBlockTag Tag:Word  !( ( [ :BlockArguments ] )? > '%>' ) */
3950
	protected $match_MalformedOpenTag_typestack = array('MalformedOpenTag');
3951
	function match_MalformedOpenTag ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
3952
		$matchrule = "MalformedOpenTag"; $result = $this->construct($matchrule, $matchrule, null);
3953
		$_668 = NULL;
0 ignored issues
show
Unused Code introduced by
$_668 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3954
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
3955
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
3956
			else { $_668 = FALSE; break; }
3957
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3958
			$res_657 = $result;
3959
			$pos_657 = $this->pos;
3960
			$matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos;
3961
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3962 View Code Duplication
			if ($subres !== FALSE) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3963
				$this->store( $result, $subres );
3964
				$result = $res_657;
3965
				$this->pos = $pos_657;
3966
				$_668 = FALSE; break;
3967
			}
3968
			else {
3969
				$result = $res_657;
3970
				$this->pos = $pos_657;
3971
			}
3972
			$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
3973
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3974
			if ($subres !== FALSE) {
3975
				$this->store( $result, $subres, "Tag" );
3976
			}
3977
			else { $_668 = FALSE; break; }
3978
			$res_667 = $result;
3979
			$pos_667 = $this->pos;
3980
			$_666 = NULL;
0 ignored issues
show
Unused Code introduced by
$_666 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3981
			do {
3982
				$res_663 = $result;
3983
				$pos_663 = $this->pos;
3984
				$_662 = NULL;
0 ignored issues
show
Unused Code introduced by
$_662 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
3985 View Code Duplication
				do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
3986
					if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3987
					else { $_662 = FALSE; break; }
3988
					$matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos;
3989
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3990
					if ($subres !== FALSE) {
3991
						$this->store( $result, $subres, "BlockArguments" );
3992
					}
3993
					else { $_662 = FALSE; break; }
3994
					if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3995
					else { $_662 = FALSE; break; }
3996
					$_662 = TRUE; break;
3997
				}
3998
				while(0);
3999
				if( $_662 === FALSE) {
4000
					$result = $res_663;
4001
					$this->pos = $pos_663;
4002
					unset( $res_663 );
4003
					unset( $pos_663 );
4004
				}
4005
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4006
				if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
4007
				else { $_666 = FALSE; break; }
4008
				$_666 = TRUE; break;
4009
			}
4010
			while(0);
4011
			if( $_666 === TRUE ) {
4012
				$result = $res_667;
4013
				$this->pos = $pos_667;
4014
				$_668 = FALSE; break;
4015
			}
4016
			if( $_666 === FALSE) {
4017
				$result = $res_667;
4018
				$this->pos = $pos_667;
4019
			}
4020
			$_668 = TRUE; break;
4021
		}
4022
		while(0);
4023
		if( $_668 === TRUE ) { return $this->finalise($result); }
4024
		if( $_668 === FALSE) { return FALSE; }
4025
	}
4026
4027
4028
4029
	function MalformedOpenTag__finalise(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
4030
		$tag = $res['Tag']['text'];
4031
		throw new SSTemplateParseException("Malformed opening block tag $tag. Perhaps you have tried to use operators?"
4032
			, $this);
4033
	}
4034
	
4035
	/* MalformedCloseTag: '<%' < Tag:('end_' :Word ) !( > '%>' ) */
4036
	protected $match_MalformedCloseTag_typestack = array('MalformedCloseTag');
4037
	function match_MalformedCloseTag ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
4038
		$matchrule = "MalformedCloseTag"; $result = $this->construct($matchrule, $matchrule, null);
4039
		$_680 = NULL;
0 ignored issues
show
Unused Code introduced by
$_680 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4040
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
4041
			if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
4042
			else { $_680 = FALSE; break; }
4043
			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4044
			$stack[] = $result; $result = $this->construct( $matchrule, "Tag" ); 
4045
			$_674 = NULL;
0 ignored issues
show
Unused Code introduced by
$_674 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4046
			do {
4047
				if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
4048
				else { $_674 = FALSE; break; }
4049
				$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
4050
				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4051
				if ($subres !== FALSE) {
4052
					$this->store( $result, $subres, "Word" );
4053
				}
4054
				else { $_674 = FALSE; break; }
4055
				$_674 = TRUE; break;
4056
			}
4057
			while(0);
4058
			if( $_674 === TRUE ) {
4059
				$subres = $result; $result = array_pop($stack);
4060
				$this->store( $result, $subres, 'Tag' );
4061
			}
4062
			if( $_674 === FALSE) {
4063
				$result = array_pop($stack);
4064
				$_680 = FALSE; break;
4065
			}
4066
			$res_679 = $result;
4067
			$pos_679 = $this->pos;
4068
			$_678 = NULL;
0 ignored issues
show
Unused Code introduced by
$_678 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4069
			do {
4070
				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4071
				if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
4072
				else { $_678 = FALSE; break; }
4073
				$_678 = TRUE; break;
4074
			}
4075
			while(0);
4076
			if( $_678 === TRUE ) {
4077
				$result = $res_679;
4078
				$this->pos = $pos_679;
4079
				$_680 = FALSE; break;
4080
			}
4081
			if( $_678 === FALSE) {
4082
				$result = $res_679;
4083
				$this->pos = $pos_679;
4084
			}
4085
			$_680 = TRUE; break;
4086
		}
4087
		while(0);
4088
		if( $_680 === TRUE ) { return $this->finalise($result); }
4089
		if( $_680 === FALSE) { return FALSE; }
4090
	}
4091
4092
4093
4094
	function MalformedCloseTag__finalise(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
4095
		$tag = $res['Tag']['text'];
4096
		throw new SSTemplateParseException("Malformed closing block tag $tag. Perhaps you have tried to pass an " .
4097
			"argument to one?", $this);
4098
	}
4099
	
4100
	/* MalformedBlock: MalformedOpenTag | MalformedCloseTag */
4101
	protected $match_MalformedBlock_typestack = array('MalformedBlock');
4102 View Code Duplication
	function match_MalformedBlock ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4103
		$matchrule = "MalformedBlock"; $result = $this->construct($matchrule, $matchrule, null);
4104
		$_685 = NULL;
0 ignored issues
show
Unused Code introduced by
$_685 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4105
		do {
0 ignored issues
show
Unused Code introduced by
do { $res_682 = $res... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
4106
			$res_682 = $result;
4107
			$pos_682 = $this->pos;
4108
			$matcher = 'match_'.'MalformedOpenTag'; $key = $matcher; $pos = $this->pos;
4109
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4110
			if ($subres !== FALSE) {
4111
				$this->store( $result, $subres );
4112
				$_685 = TRUE; break;
4113
			}
4114
			$result = $res_682;
4115
			$this->pos = $pos_682;
4116
			$matcher = 'match_'.'MalformedCloseTag'; $key = $matcher; $pos = $this->pos;
4117
			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4118
			if ($subres !== FALSE) {
4119
				$this->store( $result, $subres );
4120
				$_685 = TRUE; break;
4121
			}
4122
			$result = $res_682;
4123
			$this->pos = $pos_682;
4124
			$_685 = FALSE; break;
4125
		}
4126
		while(0);
4127
		if( $_685 === TRUE ) { return $this->finalise($result); }
4128
		if( $_685 === FALSE) { return FALSE; }
4129
	}
4130
4131
4132
4133
4134
	/* Comment: "<%--" (!"--%>" /(?s)./)+ "--%>" */
4135
	protected $match_Comment_typestack = array('Comment');
4136
	function match_Comment ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
4137
		$matchrule = "Comment"; $result = $this->construct($matchrule, $matchrule, null);
4138
		$_693 = NULL;
0 ignored issues
show
Unused Code introduced by
$_693 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4139
		do {
0 ignored issues
show
Unused Code introduced by
do { if (($subres = ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
4140
			if (( $subres = $this->literal( '<%--' ) ) !== FALSE) { $result["text"] .= $subres; }
4141
			else { $_693 = FALSE; break; }
4142
			$count = 0;
4143
			while (true) {
4144
				$res_691 = $result;
4145
				$pos_691 = $this->pos;
4146
				$_690 = NULL;
0 ignored issues
show
Unused Code introduced by
$_690 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4147
				do {
4148
					$res_688 = $result;
4149
					$pos_688 = $this->pos;
4150
					if (( $subres = $this->literal( '--%>' ) ) !== FALSE) {
4151
						$result["text"] .= $subres;
4152
						$result = $res_688;
4153
						$this->pos = $pos_688;
4154
						$_690 = FALSE; break;
4155
					}
4156
					else {
4157
						$result = $res_688;
4158
						$this->pos = $pos_688;
4159
					}
4160
					if (( $subres = $this->rx( '/(?s)./' ) ) !== FALSE) { $result["text"] .= $subres; }
4161
					else { $_690 = FALSE; break; }
4162
					$_690 = TRUE; break;
4163
				}
4164
				while(0);
4165
				if( $_690 === FALSE) {
4166
					$result = $res_691;
4167
					$this->pos = $pos_691;
4168
					unset( $res_691 );
4169
					unset( $pos_691 );
4170
					break;
4171
				}
4172
				$count += 1;
4173
			}
4174
			if ($count > 0) {  }
4175
			else { $_693 = FALSE; break; }
4176
			if (( $subres = $this->literal( '--%>' ) ) !== FALSE) { $result["text"] .= $subres; }
4177
			else { $_693 = FALSE; break; }
4178
			$_693 = TRUE; break;
4179
		}
4180
		while(0);
4181
		if( $_693 === TRUE ) { return $this->finalise($result); }
4182
		if( $_693 === FALSE) { return FALSE; }
4183
	}
4184
4185
4186
4187
	function Comment__construct(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
4188
		$res['php'] = '';
4189
	}
4190
		
4191
	/* TopTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock |
4192
	OpenBlock |  MalformedBlock | MismatchedEndBlock  | Injection | Text)+ */
4193
	protected $match_TopTemplate_typestack = array('TopTemplate','Template');
4194
	function match_TopTemplate ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
4195
		$matchrule = "TopTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'Template'));
4196
		$count = 0;
4197
		while (true) {
4198
			$res_749 = $result;
4199
			$pos_749 = $this->pos;
4200
			$_748 = NULL;
0 ignored issues
show
Unused Code introduced by
$_748 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4201
			do {
0 ignored issues
show
Unused Code introduced by
do { $_746 = NULL; ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
4202
				$_746 = NULL;
0 ignored issues
show
Unused Code introduced by
$_746 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4203
				do {
4204
					$res_695 = $result;
4205
					$pos_695 = $this->pos;
4206
					$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
4207
					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4208
					if ($subres !== FALSE) {
4209
						$this->store( $result, $subres );
4210
						$_746 = TRUE; break;
4211
					}
4212
					$result = $res_695;
4213
					$this->pos = $pos_695;
4214
					$_744 = NULL;
0 ignored issues
show
Unused Code introduced by
$_744 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4215
					do {
4216
						$res_697 = $result;
4217
						$pos_697 = $this->pos;
4218
						$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
4219
						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4220
						if ($subres !== FALSE) {
4221
							$this->store( $result, $subres );
4222
							$_744 = TRUE; break;
4223
						}
4224
						$result = $res_697;
4225
						$this->pos = $pos_697;
4226
						$_742 = NULL;
0 ignored issues
show
Unused Code introduced by
$_742 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4227
						do {
4228
							$res_699 = $result;
4229
							$pos_699 = $this->pos;
4230
							$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
4231
							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4232
							if ($subres !== FALSE) {
4233
								$this->store( $result, $subres );
4234
								$_742 = TRUE; break;
4235
							}
4236
							$result = $res_699;
4237
							$this->pos = $pos_699;
4238
							$_740 = NULL;
0 ignored issues
show
Unused Code introduced by
$_740 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4239
							do {
4240
								$res_701 = $result;
4241
								$pos_701 = $this->pos;
4242
								$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
4243
								$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4244
								if ($subres !== FALSE) {
4245
									$this->store( $result, $subres );
4246
									$_740 = TRUE; break;
4247
								}
4248
								$result = $res_701;
4249
								$this->pos = $pos_701;
4250
								$_738 = NULL;
0 ignored issues
show
Unused Code introduced by
$_738 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4251
								do {
4252
									$res_703 = $result;
4253
									$pos_703 = $this->pos;
4254
									$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
4255
									$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4256
									if ($subres !== FALSE) {
4257
										$this->store( $result, $subres );
4258
										$_738 = TRUE; break;
4259
									}
4260
									$result = $res_703;
4261
									$this->pos = $pos_703;
4262
									$_736 = NULL;
0 ignored issues
show
Unused Code introduced by
$_736 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4263
									do {
4264
										$res_705 = $result;
4265
										$pos_705 = $this->pos;
4266
										$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
4267
										$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4268
										if ($subres !== FALSE) {
4269
											$this->store( $result, $subres );
4270
											$_736 = TRUE; break;
4271
										}
4272
										$result = $res_705;
4273
										$this->pos = $pos_705;
4274
										$_734 = NULL;
0 ignored issues
show
Unused Code introduced by
$_734 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4275
										do {
4276
											$res_707 = $result;
4277
											$pos_707 = $this->pos;
4278
											$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
4279
											$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4280
											if ($subres !== FALSE) {
4281
												$this->store( $result, $subres );
4282
												$_734 = TRUE; break;
4283
											}
4284
											$result = $res_707;
4285
											$this->pos = $pos_707;
4286
											$_732 = NULL;
0 ignored issues
show
Unused Code introduced by
$_732 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4287
											do {
4288
												$res_709 = $result;
4289
												$pos_709 = $this->pos;
4290
												$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
4291
												$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4292
												if ($subres !== FALSE) {
4293
													$this->store( $result, $subres );
4294
													$_732 = TRUE; break;
4295
												}
4296
												$result = $res_709;
4297
												$this->pos = $pos_709;
4298
												$_730 = NULL;
0 ignored issues
show
Unused Code introduced by
$_730 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4299
												do {
4300
													$res_711 = $result;
4301
													$pos_711 = $this->pos;
4302
													$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
4303
													$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4304
													if ($subres !== FALSE) {
4305
														$this->store( $result, $subres );
4306
														$_730 = TRUE; break;
4307
													}
4308
													$result = $res_711;
4309
													$this->pos = $pos_711;
4310
													$_728 = NULL;
0 ignored issues
show
Unused Code introduced by
$_728 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4311
													do {
4312
														$res_713 = $result;
4313
														$pos_713 = $this->pos;
4314
														$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
4315
														$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4316
														if ($subres !== FALSE) {
4317
															$this->store( $result, $subres );
4318
															$_728 = TRUE; break;
4319
														}
4320
														$result = $res_713;
4321
														$this->pos = $pos_713;
4322
														$_726 = NULL;
0 ignored issues
show
Unused Code introduced by
$_726 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4323
														do {
4324
															$res_715 = $result;
4325
															$pos_715 = $this->pos;
4326
															$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
4327
															$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4328
															if ($subres !== FALSE) {
4329
																$this->store( $result, $subres );
4330
																$_726 = TRUE; break;
4331
															}
4332
															$result = $res_715;
4333
															$this->pos = $pos_715;
4334
															$_724 = NULL;
0 ignored issues
show
Unused Code introduced by
$_724 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4335
															do {
4336
																$res_717 = $result;
4337
																$pos_717 = $this->pos;
4338
																$matcher = 'match_'.'MismatchedEndBlock'; $key = $matcher; $pos = $this->pos;
4339
																$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4340
																if ($subres !== FALSE) {
4341
																	$this->store( $result, $subres );
4342
																	$_724 = TRUE; break;
4343
																}
4344
																$result = $res_717;
4345
																$this->pos = $pos_717;
4346
																$_722 = NULL;
0 ignored issues
show
Unused Code introduced by
$_722 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4347
																do {
4348
																	$res_719 = $result;
4349
																	$pos_719 = $this->pos;
4350
																	$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
4351
																	$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4352
																	if ($subres !== FALSE) {
4353
																		$this->store( $result, $subres );
4354
																		$_722 = TRUE; break;
4355
																	}
4356
																	$result = $res_719;
4357
																	$this->pos = $pos_719;
4358
																	$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
4359
																	$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4360
																	if ($subres !== FALSE) {
4361
																		$this->store( $result, $subres );
4362
																		$_722 = TRUE; break;
4363
																	}
4364
																	$result = $res_719;
4365
																	$this->pos = $pos_719;
4366
																	$_722 = FALSE; break;
4367
																}
4368
																while(0);
4369
																if( $_722 === TRUE ) { $_724 = TRUE; break; }
4370
																$result = $res_717;
4371
																$this->pos = $pos_717;
4372
																$_724 = FALSE; break;
4373
															}
4374
															while(0);
4375
															if( $_724 === TRUE ) { $_726 = TRUE; break; }
4376
															$result = $res_715;
4377
															$this->pos = $pos_715;
4378
															$_726 = FALSE; break;
4379
														}
4380
														while(0);
4381
														if( $_726 === TRUE ) { $_728 = TRUE; break; }
4382
														$result = $res_713;
4383
														$this->pos = $pos_713;
4384
														$_728 = FALSE; break;
4385
													}
4386
													while(0);
4387
													if( $_728 === TRUE ) { $_730 = TRUE; break; }
4388
													$result = $res_711;
4389
													$this->pos = $pos_711;
4390
													$_730 = FALSE; break;
4391
												}
4392
												while(0);
4393
												if( $_730 === TRUE ) { $_732 = TRUE; break; }
4394
												$result = $res_709;
4395
												$this->pos = $pos_709;
4396
												$_732 = FALSE; break;
4397
											}
4398
											while(0);
4399
											if( $_732 === TRUE ) { $_734 = TRUE; break; }
4400
											$result = $res_707;
4401
											$this->pos = $pos_707;
4402
											$_734 = FALSE; break;
4403
										}
4404
										while(0);
4405
										if( $_734 === TRUE ) { $_736 = TRUE; break; }
4406
										$result = $res_705;
4407
										$this->pos = $pos_705;
4408
										$_736 = FALSE; break;
4409
									}
4410
									while(0);
4411
									if( $_736 === TRUE ) { $_738 = TRUE; break; }
4412
									$result = $res_703;
4413
									$this->pos = $pos_703;
4414
									$_738 = FALSE; break;
4415
								}
4416
								while(0);
4417
								if( $_738 === TRUE ) { $_740 = TRUE; break; }
4418
								$result = $res_701;
4419
								$this->pos = $pos_701;
4420
								$_740 = FALSE; break;
4421
							}
4422
							while(0);
4423
							if( $_740 === TRUE ) { $_742 = TRUE; break; }
4424
							$result = $res_699;
4425
							$this->pos = $pos_699;
4426
							$_742 = FALSE; break;
4427
						}
4428
						while(0);
4429
						if( $_742 === TRUE ) { $_744 = TRUE; break; }
4430
						$result = $res_697;
4431
						$this->pos = $pos_697;
4432
						$_744 = FALSE; break;
4433
					}
4434
					while(0);
4435
					if( $_744 === TRUE ) { $_746 = TRUE; break; }
4436
					$result = $res_695;
4437
					$this->pos = $pos_695;
4438
					$_746 = FALSE; break;
4439
				}
4440
				while(0);
4441
				if( $_746 === FALSE) { $_748 = FALSE; break; }
4442
				$_748 = TRUE; break;
4443
			}
4444
			while(0);
4445
			if( $_748 === FALSE) {
4446
				$result = $res_749;
4447
				$this->pos = $pos_749;
4448
				unset( $res_749 );
4449
				unset( $pos_749 );
4450
				break;
4451
			}
4452
			$count += 1;
4453
		}
4454
		if ($count > 0) { return $this->finalise($result); }
4455
		else { return FALSE; }
4456
	}
4457
4458
4459
4460
	
4461
	/**
4462
	 * The TopTemplate also includes the opening stanza to start off the template
4463
	 */
4464
	function TopTemplate__construct(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
4465
		$res['php'] = "<?php" . PHP_EOL;
4466
	}
4467
4468
	/* Text: (
4469
		/ [^<${\\]+ / |
4470
		/ (\\.) / |
4471
		'<' !'%' |
4472
		'$' !(/[A-Za-z_]/) |
4473
		'{' !'$' |
4474
		'{$' !(/[A-Za-z_]/)
4475
	)+ */
4476
	protected $match_Text_typestack = array('Text');
4477
	function match_Text ($stack = array()) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
4478
		$matchrule = "Text"; $result = $this->construct($matchrule, $matchrule, null);
4479
		$count = 0;
4480
		while (true) {
4481
			$res_788 = $result;
4482
			$pos_788 = $this->pos;
4483
			$_787 = NULL;
0 ignored issues
show
Unused Code introduced by
$_787 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4484
			do {
0 ignored issues
show
Unused Code introduced by
do { $_785 = NULL; ... break; } while (0); does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
4485
				$_785 = NULL;
0 ignored issues
show
Unused Code introduced by
$_785 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4486
				do {
4487
					$res_750 = $result;
4488
					$pos_750 = $this->pos;
4489
					if (( $subres = $this->rx( '/ [^<${\\\\]+ /' ) ) !== FALSE) {
4490
						$result["text"] .= $subres;
4491
						$_785 = TRUE; break;
4492
					}
4493
					$result = $res_750;
4494
					$this->pos = $pos_750;
4495
					$_783 = NULL;
0 ignored issues
show
Unused Code introduced by
$_783 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4496
					do {
4497
						$res_752 = $result;
4498
						$pos_752 = $this->pos;
4499
						if (( $subres = $this->rx( '/ (\\\\.) /' ) ) !== FALSE) {
4500
							$result["text"] .= $subres;
4501
							$_783 = TRUE; break;
4502
						}
4503
						$result = $res_752;
4504
						$this->pos = $pos_752;
4505
						$_781 = NULL;
0 ignored issues
show
Unused Code introduced by
$_781 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4506
						do {
4507
							$res_754 = $result;
4508
							$pos_754 = $this->pos;
4509
							$_757 = NULL;
0 ignored issues
show
Unused Code introduced by
$_757 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4510 View Code Duplication
							do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4511
								if (substr($this->string,$this->pos,1) == '<') {
4512
									$this->pos += 1;
4513
									$result["text"] .= '<';
4514
								}
4515
								else { $_757 = FALSE; break; }
4516
								$res_756 = $result;
4517
								$pos_756 = $this->pos;
4518
								if (substr($this->string,$this->pos,1) == '%') {
4519
									$this->pos += 1;
4520
									$result["text"] .= '%';
4521
									$result = $res_756;
4522
									$this->pos = $pos_756;
4523
									$_757 = FALSE; break;
4524
								}
4525
								else {
4526
									$result = $res_756;
4527
									$this->pos = $pos_756;
4528
								}
4529
								$_757 = TRUE; break;
4530
							}
4531
							while(0);
4532
							if( $_757 === TRUE ) { $_781 = TRUE; break; }
4533
							$result = $res_754;
4534
							$this->pos = $pos_754;
4535
							$_779 = NULL;
0 ignored issues
show
Unused Code introduced by
$_779 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4536
							do {
4537
								$res_759 = $result;
4538
								$pos_759 = $this->pos;
4539
								$_764 = NULL;
0 ignored issues
show
Unused Code introduced by
$_764 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4540
								do {
4541
									if (substr($this->string,$this->pos,1) == '$') {
4542
										$this->pos += 1;
4543
										$result["text"] .= '$';
4544
									}
4545
									else { $_764 = FALSE; break; }
4546
									$res_763 = $result;
4547
									$pos_763 = $this->pos;
4548
									$_762 = NULL;
0 ignored issues
show
Unused Code introduced by
$_762 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4549
									do {
4550
										if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) { $result["text"] .= $subres; }
4551
										else { $_762 = FALSE; break; }
4552
										$_762 = TRUE; break;
4553
									}
4554
									while(0);
4555
									if( $_762 === TRUE ) {
4556
										$result = $res_763;
4557
										$this->pos = $pos_763;
4558
										$_764 = FALSE; break;
4559
									}
4560
									if( $_762 === FALSE) {
4561
										$result = $res_763;
4562
										$this->pos = $pos_763;
4563
									}
4564
									$_764 = TRUE; break;
4565
								}
4566
								while(0);
4567
								if( $_764 === TRUE ) { $_779 = TRUE; break; }
4568
								$result = $res_759;
4569
								$this->pos = $pos_759;
4570
								$_777 = NULL;
0 ignored issues
show
Unused Code introduced by
$_777 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4571
								do {
4572
									$res_766 = $result;
4573
									$pos_766 = $this->pos;
4574
									$_769 = NULL;
0 ignored issues
show
Unused Code introduced by
$_769 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4575 View Code Duplication
									do {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4576
										if (substr($this->string,$this->pos,1) == '{') {
4577
											$this->pos += 1;
4578
											$result["text"] .= '{';
4579
										}
4580
										else { $_769 = FALSE; break; }
4581
										$res_768 = $result;
4582
										$pos_768 = $this->pos;
4583
										if (substr($this->string,$this->pos,1) == '$') {
4584
											$this->pos += 1;
4585
											$result["text"] .= '$';
4586
											$result = $res_768;
4587
											$this->pos = $pos_768;
4588
											$_769 = FALSE; break;
4589
										}
4590
										else {
4591
											$result = $res_768;
4592
											$this->pos = $pos_768;
4593
										}
4594
										$_769 = TRUE; break;
4595
									}
4596
									while(0);
4597
									if( $_769 === TRUE ) { $_777 = TRUE; break; }
4598
									$result = $res_766;
4599
									$this->pos = $pos_766;
4600
									$_775 = NULL;
0 ignored issues
show
Unused Code introduced by
$_775 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4601
									do {
4602
										if (( $subres = $this->literal( '{$' ) ) !== FALSE) { $result["text"] .= $subres; }
4603
										else { $_775 = FALSE; break; }
4604
										$res_774 = $result;
4605
										$pos_774 = $this->pos;
4606
										$_773 = NULL;
0 ignored issues
show
Unused Code introduced by
$_773 is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
4607
										do {
4608
											if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) { $result["text"] .= $subres; }
4609
											else { $_773 = FALSE; break; }
4610
											$_773 = TRUE; break;
4611
										}
4612
										while(0);
4613
										if( $_773 === TRUE ) {
4614
											$result = $res_774;
4615
											$this->pos = $pos_774;
4616
											$_775 = FALSE; break;
4617
										}
4618
										if( $_773 === FALSE) {
4619
											$result = $res_774;
4620
											$this->pos = $pos_774;
4621
										}
4622
										$_775 = TRUE; break;
4623
									}
4624
									while(0);
4625
									if( $_775 === TRUE ) { $_777 = TRUE; break; }
4626
									$result = $res_766;
4627
									$this->pos = $pos_766;
4628
									$_777 = FALSE; break;
4629
								}
4630
								while(0);
4631
								if( $_777 === TRUE ) { $_779 = TRUE; break; }
4632
								$result = $res_759;
4633
								$this->pos = $pos_759;
4634
								$_779 = FALSE; break;
4635
							}
4636
							while(0);
4637
							if( $_779 === TRUE ) { $_781 = TRUE; break; }
4638
							$result = $res_754;
4639
							$this->pos = $pos_754;
4640
							$_781 = FALSE; break;
4641
						}
4642
						while(0);
4643
						if( $_781 === TRUE ) { $_783 = TRUE; break; }
4644
						$result = $res_752;
4645
						$this->pos = $pos_752;
4646
						$_783 = FALSE; break;
4647
					}
4648
					while(0);
4649
					if( $_783 === TRUE ) { $_785 = TRUE; break; }
4650
					$result = $res_750;
4651
					$this->pos = $pos_750;
4652
					$_785 = FALSE; break;
4653
				}
4654
				while(0);
4655
				if( $_785 === FALSE) { $_787 = FALSE; break; }
4656
				$_787 = TRUE; break;
4657
			}
4658
			while(0);
4659
			if( $_787 === FALSE) {
4660
				$result = $res_788;
4661
				$this->pos = $pos_788;
4662
				unset( $res_788 );
4663
				unset( $pos_788 );
4664
				break;
4665
			}
4666
			$count += 1;
4667
		}
4668
		if ($count > 0) { return $this->finalise($result); }
4669
		else { return FALSE; }
4670
	}
4671
4672
4673
4674
	
4675
	/**
4676
	 * We convert text 
4677
	 */
4678 View Code Duplication
	function Text__finalise(&$res) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4679
		$text = $res['text'];
4680
		
4681
		// Unescape any escaped characters in the text, then put back escapes for any single quotes and backslashes
4682
		$text = stripslashes($text);
4683
		$text = addcslashes($text, '\'\\');
4684
4685
		// TODO: This is pretty ugly & gets applied on all files not just html. I wonder if we can make this
4686
		// non-dynamically calculated
4687
		$code = <<<'EOC'
4688
(\Config::inst()->get('SSViewer', 'rewrite_hash_links')
4689
	? \Convert::raw2att( preg_replace("/^(\\/)+/", "/", $_SERVER['REQUEST_URI'] ) )
4690
	: "")
4691
EOC;
4692
		// Because preg_replace replacement requires escaped slashes, addcslashes here
4693
		$text = preg_replace(
4694
			'/(<a[^>]+href *= *)"#/i',
4695
			'\\1"\' . ' . addcslashes($code, '\\')  . ' . \'#',
4696
			$text
4697
		);
4698
4699
		$res['php'] .= '$val .= \'' . $text . '\';' . PHP_EOL;
4700
	}
4701
		
4702
	/******************
4703
	 * Here ends the parser itself. Below are utility methods to use the parser
4704
	 */
4705
	
4706
	/**
4707
	 * Compiles some passed template source code into the php code that will execute as per the template source.
4708
	 * 
4709
	 * @throws SSTemplateParseException
4710
	 * @param  $string The source of the template
4711
	 * @param string $templateName The name of the template, normally the filename the template source was loaded from
4712
	 * @param bool $includeDebuggingComments True is debugging comments should be included in the output
4713
	 * @param bool $topTemplate True if this is a top template, false if it's just a template
4714
	 * @return mixed|string The php that, when executed (via include or exec) will behave as per the template source
4715
	 */
4716 View Code Duplication
	public function compileString($string, $templateName = "", $includeDebuggingComments=false, $topTemplate = true) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4717
		if (!trim($string)) {
4718
			$code = '';
4719
		}
4720
		else {
4721
			parent::__construct($string);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (__construct() instead of compileString()). Are you sure this is correct? If so, you might want to change this to $this->__construct().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
4722
			
4723
			$this->includeDebuggingComments = $includeDebuggingComments;
4724
	
4725
			// Ignore UTF8 BOM at begining of string. TODO: Confirm this is needed, make sure SSViewer handles UTF
4726
			// (and other encodings) properly
4727
			if(substr($string, 0,3) == pack("CCC", 0xef, 0xbb, 0xbf)) $this->pos = 3;
4728
			
4729
			// Match the source against the parser
4730
			if ($topTemplate) {
4731
				$result = $this->match_TopTemplate();
4732
			} else {
4733
				$result = $this->match_Template();
4734
			}
4735
			if(!$result) throw new SSTemplateParseException('Unexpected problem parsing template', $this);
4736
	
4737
			// Get the result
4738
			$code = $result['php'];
4739
		}
4740
4741
		// Include top level debugging comments if desired
4742
		if($includeDebuggingComments && $templateName && stripos($code, "<?xml") === false) {
4743
			$code = $this->includeDebuggingComments($code, $templateName);
4744
		}	
4745
		
4746
		return $code;
4747
	}
4748
4749
	/**
4750
	 * @param string $code
4751
	 * @return string $code
4752
	 */
4753 View Code Duplication
	protected function includeDebuggingComments($code, $templateName) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
4754
		// If this template contains a doctype, put it right after it,
4755
		// if not, put it after the <html> tag to avoid IE glitches
4756
		if(stripos($code, "<!doctype") !== false) {
4757
			$code = preg_replace('/(<!doctype[^>]*("[^"]")*[^>]*>)/im', "$1\r\n<!-- template $templateName -->", $code);
4758
			$code .= "\r\n" . '$val .= \'<!-- end template ' . $templateName . ' -->\';';
4759
		} elseif(stripos($code, "<html") !== false) {
4760
			$code = preg_replace_callback('/(.*)(<html[^>]*>)(.*)/i', function($matches) use ($templateName) {
4761
				if (stripos($matches[3], '<!--') === false && stripos($matches[3], '-->') !== false) {
4762
					// after this <html> tag there is a comment close but no comment has been opened
4763
					// this most likely means that this <html> tag is inside a comment
4764
					// we should not add a comment inside a comment (invalid html)
4765
					// lets append it at the end of the comment
4766
					// an example case for this is the html5boilerplate: <!--[if IE]><html class="ie"><![endif]-->
4767
					return $matches[0];
4768
				} else {
4769
					// all other cases, add the comment and return it
4770
					return "{$matches[1]}{$matches[2]}<!-- template $templateName -->{$matches[3]}";
4771
				}
4772
			}, $code);
4773
			$code = preg_replace('/(<\/html[^>]*>)/i', "<!-- end template $templateName -->$1", $code);
4774
		} else {
4775
			$code = str_replace('<?php' . PHP_EOL, '<?php' . PHP_EOL . '$val .= \'<!-- template ' . $templateName .
4776
				' -->\';' . "\r\n", $code);
4777
			$code .= "\r\n" . '$val .= \'<!-- end template ' . $templateName . ' -->\';';
4778
		}
4779
		return $code;
4780
	}
4781
	
4782
	/**
4783
	 * Compiles some file that contains template source code, and returns the php code that will execute as per that
4784
	 * source
4785
	 * 
4786
	 * @static
4787
	 * @param  $template - A file path that contains template source code
4788
	 * @return mixed|string - The php that, when executed (via include or exec) will behave as per the template source
4789
	 */
4790
	public function compileFile($template) {
4791
		return $this->compileString(file_get_contents($template), $template);
4792
	}
4793
}
4794