SSTemplateParser::match_MalformedCloseTag()   F
last analyzed

Complexity

Conditions 17
Paths 237

Size

Total Lines 53
Code Lines 44

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 17
eloc 44
nc 237
nop 1
dl 0
loc 53
rs 3.9208
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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
namespace SilverStripe\View;
11
12
use SilverStripe\Core\Injector\Injector;
13
use Parser;
14
use InvalidArgumentException;
15
16
// phpcs:ignoreFile -- this file is automatically generated
17
18
// We want this to work when run by hand too
19
if (defined('THIRDPARTY_PATH')) {
20
    require_once(THIRDPARTY_PATH . '/php-peg/Parser.php');
21
} else {
22
    $base = dirname(__FILE__);
23
    require_once($base.'/../thirdparty/php-peg/Parser.php');
24
}
25
26
/**
27
  * This is the parser for the SilverStripe template language. It gets called on a string and uses a php-peg parser
28
  * to match that string against the language structure, building up the PHP code to execute that structure as it
29
  * parses
30
  *
31
  * The $result array that is built up as part of the parsing (see thirdparty/php-peg/README.md for more on how
32
  * parsers build results) has one special member, 'php', which contains the php equivalent of that part of the
33
  * template tree.
34
  *
35
  * Some match rules generate alternate php, or other variations, so check the per-match documentation too.
36
  *
37
  * Terms used:
38
  *
39
  * Marked: A string or lookup in the template that has been explictly marked as such - lookups by prepending with
40
  * "$" (like $Foo.Bar), strings by wrapping with single or double quotes ('Foo' or "Foo")
41
  *
42
  * Bare: The opposite of marked. An argument that has to has it's type inferred by usage and 2.4 defaults.
43
  *
44
  * Example of using a bare argument for a loop block: <% loop Foo %>
45
  *
46
  * Block: One of two SS template structures. The special characters "<%" and "%>" are used to wrap the opening and
47
  * (required or forbidden depending on which block exactly) closing block marks.
48
  *
49
  * Open Block: An SS template block that doesn't wrap any content or have a closing end tag (in fact, a closing end
50
  * tag is forbidden)
51
  *
52
  * Closed Block: An SS template block that wraps content, and requires a counterpart <% end_blockname %> tag
53
  *
54
  * Angle Bracket: angle brackets "<" and ">" are used to eat whitespace between template elements
55
  * N: eats white space including newlines (using in legacy _t support)
56
  */
57
class SSTemplateParser extends Parser implements TemplateParser
58
{
59
60
    /**
61
     * @var bool - Set true by SSTemplateParser::compileString if the template should include comments intended
62
     * for debugging (template source, included files, etc)
63
     */
64
    protected $includeDebuggingComments = false;
65
66
    /**
67
     * Stores the user-supplied closed block extension rules in the form:
68
     * array(
69
     *   'name' => function (&$res) {}
70
     * )
71
     * See SSTemplateParser::ClosedBlock_Handle_Loop for an example of what the callable should look like
72
     * @var array
73
     */
74
    protected $closedBlocks = array();
75
76
    /**
77
     * Stores the user-supplied open block extension rules in the form:
78
     * array(
79
     *   'name' => function (&$res) {}
80
     * )
81
     * See SSTemplateParser::OpenBlock_Handle_Base_tag for an example of what the callable should look like
82
     * @var array
83
     */
84
    protected $openBlocks = array();
85
86
    /**
87
     * Allow the injection of new closed & open block callables
88
     * @param array $closedBlocks
89
     * @param array $openBlocks
90
     */
91
    public function __construct($closedBlocks = array(), $openBlocks = array())
92
    {
93
        parent::__construct(null);
94
        $this->setClosedBlocks($closedBlocks);
95
        $this->setOpenBlocks($openBlocks);
96
    }
97
98
    /**
99
     * Override the function that constructs the result arrays to also prepare a 'php' item in the array
100
     */
101
    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...
102
    {
103
        $res = parent::construct($matchrule, $name, $arguments);
104
        if (!isset($res['php'])) {
105
            $res['php'] = '';
106
        }
107
        return $res;
108
    }
109
110
    /**
111
     * Set the closed blocks that the template parser should use
112
     *
113
     * This method will delete any existing closed blocks, please use addClosedBlock if you don't
114
     * want to overwrite
115
     * @param array $closedBlocks
116
     * @throws InvalidArgumentException
117
     */
118
    public function setClosedBlocks($closedBlocks)
119
    {
120
        $this->closedBlocks = array();
121
        foreach ((array) $closedBlocks as $name => $callable) {
122
            $this->addClosedBlock($name, $callable);
123
        }
124
    }
125
126
    /**
127
     * Set the open blocks that the template parser should use
128
     *
129
     * This method will delete any existing open blocks, please use addOpenBlock if you don't
130
     * want to overwrite
131
     * @param array $openBlocks
132
     * @throws InvalidArgumentException
133
     */
134
    public function setOpenBlocks($openBlocks)
135
    {
136
        $this->openBlocks = array();
137
        foreach ((array) $openBlocks as $name => $callable) {
138
            $this->addOpenBlock($name, $callable);
139
        }
140
    }
141
142
    /**
143
     * Add a closed block callable to allow <% name %><% end_name %> syntax
144
     * @param string $name The name of the token to be used in the syntax <% name %><% end_name %>
145
     * @param callable $callable The function that modifies the generation of template code
146
     * @throws InvalidArgumentException
147
     */
148
    public function addClosedBlock($name, $callable)
149
    {
150
        $this->validateExtensionBlock($name, $callable, 'Closed block');
151
        $this->closedBlocks[$name] = $callable;
152
    }
153
154
    /**
155
     * Add a closed block callable to allow <% name %> syntax
156
     * @param string $name The name of the token to be used in the syntax <% name %>
157
     * @param callable $callable The function that modifies the generation of template code
158
     * @throws InvalidArgumentException
159
     */
160
    public function addOpenBlock($name, $callable)
161
    {
162
        $this->validateExtensionBlock($name, $callable, 'Open block');
163
        $this->openBlocks[$name] = $callable;
164
    }
165
166
    /**
167
     * Ensures that the arguments to addOpenBlock and addClosedBlock are valid
168
     * @param $name
169
     * @param $callable
170
     * @param $type
171
     * @throws InvalidArgumentException
172
     */
173
    protected function validateExtensionBlock($name, $callable, $type)
174
    {
175
        if (!is_string($name)) {
176
            throw new InvalidArgumentException(
177
                sprintf(
178
                    "Name argument for %s must be a string",
179
                    $type
180
                )
181
            );
182
        } elseif (!is_callable($callable)) {
183
            throw new InvalidArgumentException(
184
                sprintf(
185
                    "Callable %s argument named '%s' is not callable",
186
                    $type,
187
                    $name
188
                )
189
            );
190
        }
191
    }
192
193
    /* Template: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock |
194
    OpenBlock | MalformedBlock | Injection | Text)+ */
195
    protected $match_Template_typestack = array('Template');
196
    function match_Template ($stack = array()) {
197
    	$matchrule = "Template"; $result = $this->construct($matchrule, $matchrule, null);
198
    	$count = 0;
199
    	while (true) {
200
    		$res_50 = $result;
201
    		$pos_50 = $this->pos;
202
    		$_49 = NULL;
203
    		do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
204
    			$_47 = NULL;
205
    			do {
206
    				$res_0 = $result;
207
    				$pos_0 = $this->pos;
208
    				$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
209
    				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
210
    				if ($subres !== FALSE) {
211
    					$this->store( $result, $subres );
212
    					$_47 = TRUE; break;
213
    				}
214
    				$result = $res_0;
215
    				$this->pos = $pos_0;
216
    				$_45 = NULL;
217
    				do {
218
    					$res_2 = $result;
219
    					$pos_2 = $this->pos;
220
    					$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
221
    					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
222
    					if ($subres !== FALSE) {
223
    						$this->store( $result, $subres );
224
    						$_45 = TRUE; break;
225
    					}
226
    					$result = $res_2;
227
    					$this->pos = $pos_2;
228
    					$_43 = NULL;
229
    					do {
230
    						$res_4 = $result;
231
    						$pos_4 = $this->pos;
232
    						$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
233
    						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
234
    						if ($subres !== FALSE) {
235
    							$this->store( $result, $subres );
236
    							$_43 = TRUE; break;
237
    						}
238
    						$result = $res_4;
239
    						$this->pos = $pos_4;
240
    						$_41 = NULL;
241
    						do {
242
    							$res_6 = $result;
243
    							$pos_6 = $this->pos;
244
    							$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
245
    							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
246
    							if ($subres !== FALSE) {
247
    								$this->store( $result, $subres );
248
    								$_41 = TRUE; break;
249
    							}
250
    							$result = $res_6;
251
    							$this->pos = $pos_6;
252
    							$_39 = NULL;
253
    							do {
254
    								$res_8 = $result;
255
    								$pos_8 = $this->pos;
256
    								$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
257
    								$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
258
    								if ($subres !== FALSE) {
259
    									$this->store( $result, $subres );
260
    									$_39 = TRUE; break;
261
    								}
262
    								$result = $res_8;
263
    								$this->pos = $pos_8;
264
    								$_37 = NULL;
265
    								do {
266
    									$res_10 = $result;
267
    									$pos_10 = $this->pos;
268
    									$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
269
    									$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
270
    									if ($subres !== FALSE) {
271
    										$this->store( $result, $subres );
272
    										$_37 = TRUE; break;
273
    									}
274
    									$result = $res_10;
275
    									$this->pos = $pos_10;
276
    									$_35 = NULL;
277
    									do {
278
    										$res_12 = $result;
279
    										$pos_12 = $this->pos;
280
    										$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
281
    										$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
282
    										if ($subres !== FALSE) {
283
    											$this->store( $result, $subres );
284
    											$_35 = TRUE; break;
285
    										}
286
    										$result = $res_12;
287
    										$this->pos = $pos_12;
288
    										$_33 = NULL;
289
    										do {
290
    											$res_14 = $result;
291
    											$pos_14 = $this->pos;
292
    											$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
293
    											$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
294
    											if ($subres !== FALSE) {
295
    												$this->store( $result, $subres );
296
    												$_33 = TRUE; break;
297
    											}
298
    											$result = $res_14;
299
    											$this->pos = $pos_14;
300
    											$_31 = NULL;
301
    											do {
302
    												$res_16 = $result;
303
    												$pos_16 = $this->pos;
304
    												$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
305
    												$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
306
    												if ($subres !== FALSE) {
307
    													$this->store( $result, $subres );
308
    													$_31 = TRUE; break;
309
    												}
310
    												$result = $res_16;
311
    												$this->pos = $pos_16;
312
    												$_29 = NULL;
313
    												do {
314
    													$res_18 = $result;
315
    													$pos_18 = $this->pos;
316
    													$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
317
    													$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
318
    													if ($subres !== FALSE) {
319
    														$this->store( $result, $subres );
320
    														$_29 = TRUE; break;
321
    													}
322
    													$result = $res_18;
323
    													$this->pos = $pos_18;
324
    													$_27 = NULL;
325
    													do {
326
    														$res_20 = $result;
327
    														$pos_20 = $this->pos;
328
    														$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
329
    														$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
330
    														if ($subres !== FALSE) {
331
    															$this->store( $result, $subres );
332
    															$_27 = TRUE; break;
333
    														}
334
    														$result = $res_20;
335
    														$this->pos = $pos_20;
336
    														$_25 = NULL;
337
    														do {
338
    															$res_22 = $result;
339
    															$pos_22 = $this->pos;
340
    															$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
341
    															$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
342
    															if ($subres !== FALSE) {
343
    																$this->store( $result, $subres );
344
    																$_25 = TRUE; break;
345
    															}
346
    															$result = $res_22;
347
    															$this->pos = $pos_22;
348
    															$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
349
    															$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
350
    															if ($subres !== FALSE) {
351
    																$this->store( $result, $subres );
352
    																$_25 = TRUE; break;
353
    															}
354
    															$result = $res_22;
355
    															$this->pos = $pos_22;
356
    															$_25 = FALSE; break;
357
    														}
358
    														while(0);
359
    														if( $_25 === TRUE ) { $_27 = TRUE; break; }
360
    														$result = $res_20;
361
    														$this->pos = $pos_20;
362
    														$_27 = FALSE; break;
363
    													}
364
    													while(0);
365
    													if( $_27 === TRUE ) { $_29 = TRUE; break; }
366
    													$result = $res_18;
367
    													$this->pos = $pos_18;
368
    													$_29 = FALSE; break;
369
    												}
370
    												while(0);
371
    												if( $_29 === TRUE ) { $_31 = TRUE; break; }
372
    												$result = $res_16;
373
    												$this->pos = $pos_16;
374
    												$_31 = FALSE; break;
375
    											}
376
    											while(0);
377
    											if( $_31 === TRUE ) { $_33 = TRUE; break; }
378
    											$result = $res_14;
379
    											$this->pos = $pos_14;
380
    											$_33 = FALSE; break;
381
    										}
382
    										while(0);
383
    										if( $_33 === TRUE ) { $_35 = TRUE; break; }
384
    										$result = $res_12;
385
    										$this->pos = $pos_12;
386
    										$_35 = FALSE; break;
387
    									}
388
    									while(0);
389
    									if( $_35 === TRUE ) { $_37 = TRUE; break; }
390
    									$result = $res_10;
391
    									$this->pos = $pos_10;
392
    									$_37 = FALSE; break;
393
    								}
394
    								while(0);
395
    								if( $_37 === TRUE ) { $_39 = TRUE; break; }
396
    								$result = $res_8;
397
    								$this->pos = $pos_8;
398
    								$_39 = FALSE; break;
399
    							}
400
    							while(0);
401
    							if( $_39 === TRUE ) { $_41 = TRUE; break; }
402
    							$result = $res_6;
403
    							$this->pos = $pos_6;
404
    							$_41 = FALSE; break;
405
    						}
406
    						while(0);
407
    						if( $_41 === TRUE ) { $_43 = TRUE; break; }
408
    						$result = $res_4;
409
    						$this->pos = $pos_4;
410
    						$_43 = FALSE; break;
411
    					}
412
    					while(0);
413
    					if( $_43 === TRUE ) { $_45 = TRUE; break; }
414
    					$result = $res_2;
415
    					$this->pos = $pos_2;
416
    					$_45 = FALSE; break;
417
    				}
418
    				while(0);
419
    				if( $_45 === TRUE ) { $_47 = TRUE; break; }
420
    				$result = $res_0;
421
    				$this->pos = $pos_0;
422
    				$_47 = FALSE; break;
423
    			}
424
    			while(0);
425
    			if( $_47 === FALSE) { $_49 = FALSE; break; }
426
    			$_49 = TRUE; break;
427
    		}
428
    		while(0);
429
    		if( $_49 === FALSE) {
430
    			$result = $res_50;
431
    			$this->pos = $pos_50;
432
    			unset( $res_50 );
433
    			unset( $pos_50 );
434
    			break;
435
    		}
436
    		$count += 1;
437
    	}
438
    	if ($count > 0) { return $this->finalise($result); }
439
    	else { return FALSE; }
440
    }
441
442
443
444
    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...
445
    {
446
        $res['php'] .= $sub['php'] . PHP_EOL ;
447
    }
448
449
    /* Word: / [A-Za-z_] [A-Za-z0-9_]* / */
450
    protected $match_Word_typestack = array('Word');
451
    function match_Word ($stack = array()) {
452
    	$matchrule = "Word"; $result = $this->construct($matchrule, $matchrule, null);
453
    	if (( $subres = $this->rx( '/ [A-Za-z_] [A-Za-z0-9_]* /' ) ) !== FALSE) {
454
    		$result["text"] .= $subres;
455
    		return $this->finalise($result);
456
    	}
457
    	else { return FALSE; }
458
    }
459
460
461
    /* NamespacedWord: / [A-Za-z_\/\\] [A-Za-z0-9_\/\\]* / */
462
    protected $match_NamespacedWord_typestack = array('NamespacedWord');
463
    function match_NamespacedWord ($stack = array()) {
464
    	$matchrule = "NamespacedWord"; $result = $this->construct($matchrule, $matchrule, null);
465
    	if (( $subres = $this->rx( '/ [A-Za-z_\/\\\\] [A-Za-z0-9_\/\\\\]* /' ) ) !== FALSE) {
466
    		$result["text"] .= $subres;
467
    		return $this->finalise($result);
468
    	}
469
    	else { return FALSE; }
470
    }
471
472
473
    /* Number: / [0-9]+ / */
474
    protected $match_Number_typestack = array('Number');
475
    function match_Number ($stack = array()) {
476
    	$matchrule = "Number"; $result = $this->construct($matchrule, $matchrule, null);
477
    	if (( $subres = $this->rx( '/ [0-9]+ /' ) ) !== FALSE) {
478
    		$result["text"] .= $subres;
479
    		return $this->finalise($result);
480
    	}
481
    	else { return FALSE; }
482
    }
483
484
485
    /* Value: / [A-Za-z0-9_]+ / */
486
    protected $match_Value_typestack = array('Value');
487
    function match_Value ($stack = array()) {
488
    	$matchrule = "Value"; $result = $this->construct($matchrule, $matchrule, null);
489
    	if (( $subres = $this->rx( '/ [A-Za-z0-9_]+ /' ) ) !== FALSE) {
490
    		$result["text"] .= $subres;
491
    		return $this->finalise($result);
492
    	}
493
    	else { return FALSE; }
494
    }
495
496
497
    /* CallArguments: :Argument ( < "," < :Argument )* */
498
    protected $match_CallArguments_typestack = array('CallArguments');
499
    function match_CallArguments ($stack = array()) {
500
    	$matchrule = "CallArguments"; $result = $this->construct($matchrule, $matchrule, null);
501
    	$_62 = NULL;
502
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
503
    		$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
504
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
505
    		if ($subres !== FALSE) {
506
    			$this->store( $result, $subres, "Argument" );
507
    		}
508
    		else { $_62 = FALSE; break; }
509
    		while (true) {
510
    			$res_61 = $result;
511
    			$pos_61 = $this->pos;
512
    			$_60 = NULL;
513
    			do {
514
    				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
515
    				if (substr($this->string,$this->pos,1) == ',') {
516
    					$this->pos += 1;
517
    					$result["text"] .= ',';
518
    				}
519
    				else { $_60 = FALSE; break; }
520
    				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
521
    				$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
522
    				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
523
    				if ($subres !== FALSE) {
524
    					$this->store( $result, $subres, "Argument" );
525
    				}
526
    				else { $_60 = FALSE; break; }
527
    				$_60 = TRUE; break;
528
    			}
529
    			while(0);
530
    			if( $_60 === FALSE) {
531
    				$result = $res_61;
532
    				$this->pos = $pos_61;
533
    				unset( $res_61 );
534
    				unset( $pos_61 );
535
    				break;
536
    			}
537
    		}
538
    		$_62 = TRUE; break;
539
    	}
540
    	while(0);
541
    	if( $_62 === TRUE ) { return $this->finalise($result); }
542
    	if( $_62 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_62 === FALSE is always true.
Loading history...
543
    }
544
545
546
547
548
    /**
549
     * Values are bare words in templates, but strings in PHP. We rely on PHP's type conversion to back-convert
550
     * strings to numbers when needed.
551
     */
552
    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...
553
    {
554
        if (!empty($res['php'])) {
555
            $res['php'] .= ', ';
556
        }
557
558
        $res['php'] .= ($sub['ArgumentMode'] == 'default') ? $sub['string_php'] :
559
            str_replace('$$FINAL', 'XML_val', $sub['php']);
560
    }
561
562
    /* Call: Method:Word ( "(" < :CallArguments? > ")" )? */
563
    protected $match_Call_typestack = array('Call');
564
    function match_Call ($stack = array()) {
565
    	$matchrule = "Call"; $result = $this->construct($matchrule, $matchrule, null);
566
    	$_72 = NULL;
567
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
568
    		$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
569
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
570
    		if ($subres !== FALSE) {
571
    			$this->store( $result, $subres, "Method" );
572
    		}
573
    		else { $_72 = FALSE; break; }
574
    		$res_71 = $result;
575
    		$pos_71 = $this->pos;
576
    		$_70 = NULL;
577
    		do {
578
    			if (substr($this->string,$this->pos,1) == '(') {
579
    				$this->pos += 1;
580
    				$result["text"] .= '(';
581
    			}
582
    			else { $_70 = FALSE; break; }
583
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
584
    			$res_67 = $result;
585
    			$pos_67 = $this->pos;
586
    			$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
587
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
588
    			if ($subres !== FALSE) {
589
    				$this->store( $result, $subres, "CallArguments" );
590
    			}
591
    			else {
592
    				$result = $res_67;
593
    				$this->pos = $pos_67;
594
    				unset( $res_67 );
595
    				unset( $pos_67 );
596
    			}
597
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
598
    			if (substr($this->string,$this->pos,1) == ')') {
599
    				$this->pos += 1;
600
    				$result["text"] .= ')';
601
    			}
602
    			else { $_70 = FALSE; break; }
603
    			$_70 = TRUE; break;
604
    		}
605
    		while(0);
606
    		if( $_70 === FALSE) {
607
    			$result = $res_71;
608
    			$this->pos = $pos_71;
609
    			unset( $res_71 );
610
    			unset( $pos_71 );
611
    		}
612
    		$_72 = TRUE; break;
613
    	}
614
    	while(0);
615
    	if( $_72 === TRUE ) { return $this->finalise($result); }
616
    	if( $_72 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_72 === FALSE is always true.
Loading history...
617
    }
618
619
620
    /* LookupStep: :Call &"." */
621
    protected $match_LookupStep_typestack = array('LookupStep');
622
    function match_LookupStep ($stack = array()) {
623
    	$matchrule = "LookupStep"; $result = $this->construct($matchrule, $matchrule, null);
624
    	$_76 = NULL;
625
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
626
    		$matcher = 'match_'.'Call'; $key = $matcher; $pos = $this->pos;
627
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
628
    		if ($subres !== FALSE) {
629
    			$this->store( $result, $subres, "Call" );
630
    		}
631
    		else { $_76 = FALSE; break; }
632
    		$res_75 = $result;
633
    		$pos_75 = $this->pos;
634
    		if (substr($this->string,$this->pos,1) == '.') {
635
    			$this->pos += 1;
636
    			$result["text"] .= '.';
637
    			$result = $res_75;
638
    			$this->pos = $pos_75;
639
    		}
640
    		else {
641
    			$result = $res_75;
642
    			$this->pos = $pos_75;
643
    			$_76 = FALSE; break;
644
    		}
645
    		$_76 = TRUE; break;
646
    	}
647
    	while(0);
648
    	if( $_76 === TRUE ) { return $this->finalise($result); }
649
    	if( $_76 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_76 === FALSE is always true.
Loading history...
650
    }
651
652
653
    /* LastLookupStep: :Call */
654
    protected $match_LastLookupStep_typestack = array('LastLookupStep');
655
    function match_LastLookupStep ($stack = array()) {
656
    	$matchrule = "LastLookupStep"; $result = $this->construct($matchrule, $matchrule, null);
657
    	$matcher = 'match_'.'Call'; $key = $matcher; $pos = $this->pos;
658
    	$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
659
    	if ($subres !== FALSE) {
660
    		$this->store( $result, $subres, "Call" );
661
    		return $this->finalise($result);
662
    	}
663
    	else { return FALSE; }
664
    }
665
666
667
    /* Lookup: LookupStep ("." LookupStep)* "." LastLookupStep | LastLookupStep */
668
    protected $match_Lookup_typestack = array('Lookup');
669
    function match_Lookup ($stack = array()) {
670
    	$matchrule = "Lookup"; $result = $this->construct($matchrule, $matchrule, null);
671
    	$_90 = NULL;
672
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
673
    		$res_79 = $result;
674
    		$pos_79 = $this->pos;
675
    		$_87 = NULL;
676
    		do {
677
    			$matcher = 'match_'.'LookupStep'; $key = $matcher; $pos = $this->pos;
678
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
679
    			if ($subres !== FALSE) {
680
    				$this->store( $result, $subres );
681
    			}
682
    			else { $_87 = FALSE; break; }
683
    			while (true) {
684
    				$res_84 = $result;
685
    				$pos_84 = $this->pos;
686
    				$_83 = NULL;
687
    				do {
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) {
718
    				$this->store( $result, $subres );
719
    			}
720
    			else { $_87 = FALSE; break; }
721
    			$_87 = TRUE; break;
722
    		}
723
    		while(0);
724
    		if( $_87 === TRUE ) { $_90 = TRUE; break; }
725
    		$result = $res_79;
726
    		$this->pos = $pos_79;
727
    		$matcher = 'match_'.'LastLookupStep'; $key = $matcher; $pos = $this->pos;
728
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
729
    		if ($subres !== FALSE) {
730
    			$this->store( $result, $subres );
731
    			$_90 = TRUE; break;
732
    		}
733
    		$result = $res_79;
734
    		$this->pos = $pos_79;
735
    		$_90 = FALSE; break;
736
    	}
737
    	while(0);
738
    	if( $_90 === TRUE ) { return $this->finalise($result); }
739
    	if( $_90 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_90 === FALSE is always true.
Loading history...
740
    }
741
742
743
744
745
    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...
746
    {
747
        $res['php'] = '$scope->locally()';
748
        $res['LookupSteps'] = array();
749
    }
750
751
    /**
752
     * The basic generated PHP of LookupStep and LastLookupStep is the same, except that LookupStep calls 'obj' to
753
     * get the next ViewableData in the sequence, and LastLookupStep calls different methods (XML_val, hasValue, obj)
754
     * depending on the context the lookup is used in.
755
     */
756
    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...
757
    {
758
        $res['LookupSteps'][] = $sub;
759
760
        $property = $sub['Call']['Method']['text'];
761
762
        if (isset($sub['Call']['CallArguments']) && isset($sub['Call']['CallArguments']['php'])) {
763
            $arguments = $sub['Call']['CallArguments']['php'];
764
            $res['php'] .= "->$method('$property', array($arguments), true)";
765
        } else {
766
            $res['php'] .= "->$method('$property', null, true)";
767
        }
768
    }
769
770
    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...
771
    {
772
        $this->Lookup_AddLookupStep($res, $sub, 'obj');
773
    }
774
775
    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...
776
    {
777
        $this->Lookup_AddLookupStep($res, $sub, '$$FINAL');
778
    }
779
780
781
    /* Translate: "<%t" < Entity < (Default:QuotedString)? < (!("is" "=") < "is" < Context:QuotedString)? <
782
    (InjectionVariables)? > "%>" */
783
    protected $match_Translate_typestack = array('Translate');
784
    function match_Translate ($stack = array()) {
785
    	$matchrule = "Translate"; $result = $this->construct($matchrule, $matchrule, null);
786
    	$_116 = NULL;
787
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
788
    		if (( $subres = $this->literal( '<%t' ) ) !== FALSE) { $result["text"] .= $subres; }
789
    		else { $_116 = FALSE; break; }
790
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
791
    		$matcher = 'match_'.'Entity'; $key = $matcher; $pos = $this->pos;
792
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
793
    		if ($subres !== FALSE) {
794
    			$this->store( $result, $subres );
795
    		}
796
    		else { $_116 = FALSE; break; }
797
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
798
    		$res_98 = $result;
799
    		$pos_98 = $this->pos;
800
    		$_97 = NULL;
801
    		do {
802
    			$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
803
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
804
    			if ($subres !== FALSE) {
805
    				$this->store( $result, $subres, "Default" );
806
    			}
807
    			else { $_97 = FALSE; break; }
808
    			$_97 = TRUE; break;
809
    		}
810
    		while(0);
811
    		if( $_97 === FALSE) {
812
    			$result = $res_98;
813
    			$this->pos = $pos_98;
814
    			unset( $res_98 );
815
    			unset( $pos_98 );
816
    		}
817
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
818
    		$res_109 = $result;
819
    		$pos_109 = $this->pos;
820
    		$_108 = NULL;
821
    		do {
822
    			$res_103 = $result;
823
    			$pos_103 = $this->pos;
824
    			$_102 = NULL;
825
    			do {
826
    				if (( $subres = $this->literal( 'is' ) ) !== FALSE) { $result["text"] .= $subres; }
827
    				else { $_102 = FALSE; break; }
828
    				if (substr($this->string,$this->pos,1) == '=') {
829
    					$this->pos += 1;
830
    					$result["text"] .= '=';
831
    				}
832
    				else { $_102 = FALSE; break; }
833
    				$_102 = TRUE; break;
834
    			}
835
    			while(0);
836
    			if( $_102 === TRUE ) {
837
    				$result = $res_103;
838
    				$this->pos = $pos_103;
839
    				$_108 = FALSE; break;
840
    			}
841
    			if( $_102 === FALSE) {
842
    				$result = $res_103;
843
    				$this->pos = $pos_103;
844
    			}
845
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
846
    			if (( $subres = $this->literal( 'is' ) ) !== FALSE) { $result["text"] .= $subres; }
847
    			else { $_108 = FALSE; break; }
848
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
849
    			$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
850
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
851
    			if ($subres !== FALSE) {
852
    				$this->store( $result, $subres, "Context" );
853
    			}
854
    			else { $_108 = FALSE; break; }
855
    			$_108 = TRUE; break;
856
    		}
857
    		while(0);
858
    		if( $_108 === FALSE) {
859
    			$result = $res_109;
860
    			$this->pos = $pos_109;
861
    			unset( $res_109 );
862
    			unset( $pos_109 );
863
    		}
864
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
865
    		$res_113 = $result;
866
    		$pos_113 = $this->pos;
867
    		$_112 = NULL;
868
    		do {
869
    			$matcher = 'match_'.'InjectionVariables'; $key = $matcher; $pos = $this->pos;
870
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
871
    			if ($subres !== FALSE) {
872
    				$this->store( $result, $subres );
873
    			}
874
    			else { $_112 = FALSE; break; }
875
    			$_112 = TRUE; break;
876
    		}
877
    		while(0);
878
    		if( $_112 === FALSE) {
879
    			$result = $res_113;
880
    			$this->pos = $pos_113;
881
    			unset( $res_113 );
882
    			unset( $pos_113 );
883
    		}
884
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
885
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
886
    		else { $_116 = FALSE; break; }
887
    		$_116 = TRUE; break;
888
    	}
889
    	while(0);
890
    	if( $_116 === TRUE ) { return $this->finalise($result); }
891
    	if( $_116 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_116 === FALSE is always true.
Loading history...
892
    }
893
894
895
    /* InjectionVariables: (< InjectionName:Word "=" Argument)+ */
896
    protected $match_InjectionVariables_typestack = array('InjectionVariables');
897
    function match_InjectionVariables ($stack = array()) {
898
    	$matchrule = "InjectionVariables"; $result = $this->construct($matchrule, $matchrule, null);
899
    	$count = 0;
900
    	while (true) {
901
    		$res_123 = $result;
902
    		$pos_123 = $this->pos;
903
    		$_122 = NULL;
904
    		do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
905
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
906
    			$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
907
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
908
    			if ($subres !== FALSE) {
909
    				$this->store( $result, $subres, "InjectionName" );
910
    			}
911
    			else { $_122 = FALSE; break; }
912
    			if (substr($this->string,$this->pos,1) == '=') {
913
    				$this->pos += 1;
914
    				$result["text"] .= '=';
915
    			}
916
    			else { $_122 = FALSE; break; }
917
    			$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
918
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
919
    			if ($subres !== FALSE) {
920
    				$this->store( $result, $subres );
921
    			}
922
    			else { $_122 = FALSE; break; }
923
    			$_122 = TRUE; break;
924
    		}
925
    		while(0);
926
    		if( $_122 === FALSE) {
927
    			$result = $res_123;
928
    			$this->pos = $pos_123;
929
    			unset( $res_123 );
930
    			unset( $pos_123 );
931
    			break;
932
    		}
933
    		$count += 1;
934
    	}
935
    	if ($count > 0) { return $this->finalise($result); }
936
    	else { return FALSE; }
937
    }
938
939
940
    /* Entity: / [A-Za-z_\\] [\w\.\\]* / */
941
    protected $match_Entity_typestack = array('Entity');
942
    function match_Entity ($stack = array()) {
943
    	$matchrule = "Entity"; $result = $this->construct($matchrule, $matchrule, null);
944
    	if (( $subres = $this->rx( '/ [A-Za-z_\\\\] [\w\.\\\\]* /' ) ) !== FALSE) {
945
    		$result["text"] .= $subres;
946
    		return $this->finalise($result);
947
    	}
948
    	else { return FALSE; }
949
    }
950
951
952
953
954
    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...
955
    {
956
        $res['php'] = '$val .= _t(';
957
    }
958
959
    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...
960
    {
961
        $res['php'] .= "'$sub[text]'";
962
    }
963
964
    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...
965
    {
966
        $res['php'] .= ",$sub[text]";
967
    }
968
969
    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...
970
    {
971
        $res['php'] .= ",$sub[text]";
972
    }
973
974
    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...
975
    {
976
        $res['php'] .= ",$sub[php]";
977
    }
978
979
    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...
980
    {
981
        $res['php'] .= ');';
982
    }
983
984
    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...
985
    {
986
        $res['php'] = "array(";
987
    }
988
989
    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...
990
    {
991
        $res['php'] .= "'$sub[text]'=>";
992
    }
993
994
    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...
995
    {
996
        $res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']) . ',';
997
    }
998
999
    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...
1000
    {
1001
        if (substr($res['php'], -1) == ',') {
1002
            $res['php'] = substr($res['php'], 0, -1); //remove last comma in the array
1003
        }
1004
        $res['php'] .= ')';
1005
    }
1006
1007
1008
    /* SimpleInjection: '$' :Lookup */
1009
    protected $match_SimpleInjection_typestack = array('SimpleInjection');
1010
    function match_SimpleInjection ($stack = array()) {
1011
    	$matchrule = "SimpleInjection"; $result = $this->construct($matchrule, $matchrule, null);
1012
    	$_127 = NULL;
1013
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
1014
    		if (substr($this->string,$this->pos,1) == '$') {
1015
    			$this->pos += 1;
1016
    			$result["text"] .= '$';
1017
    		}
1018
    		else { $_127 = FALSE; break; }
1019
    		$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
1020
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1021
    		if ($subres !== FALSE) {
1022
    			$this->store( $result, $subres, "Lookup" );
1023
    		}
1024
    		else { $_127 = FALSE; break; }
1025
    		$_127 = TRUE; break;
1026
    	}
1027
    	while(0);
1028
    	if( $_127 === TRUE ) { return $this->finalise($result); }
1029
    	if( $_127 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_127 === FALSE is always true.
Loading history...
1030
    }
1031
1032
1033
    /* BracketInjection: '{$' :Lookup "}" */
1034
    protected $match_BracketInjection_typestack = array('BracketInjection');
1035
    function match_BracketInjection ($stack = array()) {
1036
    	$matchrule = "BracketInjection"; $result = $this->construct($matchrule, $matchrule, null);
1037
    	$_132 = NULL;
1038
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
1039
    		if (( $subres = $this->literal( '{$' ) ) !== FALSE) { $result["text"] .= $subres; }
1040
    		else { $_132 = FALSE; break; }
1041
    		$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
1042
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1043
    		if ($subres !== FALSE) {
1044
    			$this->store( $result, $subres, "Lookup" );
1045
    		}
1046
    		else { $_132 = FALSE; break; }
1047
    		if (substr($this->string,$this->pos,1) == '}') {
1048
    			$this->pos += 1;
1049
    			$result["text"] .= '}';
1050
    		}
1051
    		else { $_132 = FALSE; break; }
1052
    		$_132 = TRUE; break;
1053
    	}
1054
    	while(0);
1055
    	if( $_132 === TRUE ) { return $this->finalise($result); }
1056
    	if( $_132 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_132 === FALSE is always true.
Loading history...
1057
    }
1058
1059
1060
    /* Injection: BracketInjection | SimpleInjection */
1061
    protected $match_Injection_typestack = array('Injection');
1062
    function match_Injection ($stack = array()) {
1063
    	$matchrule = "Injection"; $result = $this->construct($matchrule, $matchrule, null);
1064
    	$_137 = NULL;
1065
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
1066
    		$res_134 = $result;
1067
    		$pos_134 = $this->pos;
1068
    		$matcher = 'match_'.'BracketInjection'; $key = $matcher; $pos = $this->pos;
1069
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1070
    		if ($subres !== FALSE) {
1071
    			$this->store( $result, $subres );
1072
    			$_137 = TRUE; break;
1073
    		}
1074
    		$result = $res_134;
1075
    		$this->pos = $pos_134;
1076
    		$matcher = 'match_'.'SimpleInjection'; $key = $matcher; $pos = $this->pos;
1077
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1078
    		if ($subres !== FALSE) {
1079
    			$this->store( $result, $subres );
1080
    			$_137 = TRUE; break;
1081
    		}
1082
    		$result = $res_134;
1083
    		$this->pos = $pos_134;
1084
    		$_137 = FALSE; break;
1085
    	}
1086
    	while(0);
1087
    	if( $_137 === TRUE ) { return $this->finalise($result); }
1088
    	if( $_137 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_137 === FALSE is always true.
Loading history...
1089
    }
1090
1091
1092
1093
    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...
1094
    {
1095
        $res['php'] = '$val .= '. str_replace('$$FINAL', 'XML_val', $sub['Lookup']['php']) . ';';
1096
    }
1097
1098
    /* DollarMarkedLookup: SimpleInjection */
1099
    protected $match_DollarMarkedLookup_typestack = array('DollarMarkedLookup');
1100
    function match_DollarMarkedLookup ($stack = array()) {
1101
    	$matchrule = "DollarMarkedLookup"; $result = $this->construct($matchrule, $matchrule, null);
1102
    	$matcher = 'match_'.'SimpleInjection'; $key = $matcher; $pos = $this->pos;
1103
    	$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1104
    	if ($subres !== FALSE) {
1105
    		$this->store( $result, $subres );
1106
    		return $this->finalise($result);
1107
    	}
1108
    	else { return FALSE; }
1109
    }
1110
1111
1112
1113
    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...
1114
    {
1115
        $res['Lookup'] = $sub['Lookup'];
1116
    }
1117
1118
    /* QuotedString: q:/['"]/   String:/ (\\\\ | \\. | [^$q\\])* /   '$q' */
1119
    protected $match_QuotedString_typestack = array('QuotedString');
1120
    function match_QuotedString ($stack = array()) {
1121
    	$matchrule = "QuotedString"; $result = $this->construct($matchrule, $matchrule, null);
1122
    	$_143 = NULL;
1123
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
1124
    		$stack[] = $result; $result = $this->construct( $matchrule, "q" ); 
1125
    		if (( $subres = $this->rx( '/[\'"]/' ) ) !== FALSE) {
1126
    			$result["text"] .= $subres;
1127
    			$subres = $result; $result = array_pop($stack);
1128
    			$this->store( $result, $subres, 'q' );
1129
    		}
1130
    		else {
1131
    			$result = array_pop($stack);
1132
    			$_143 = FALSE; break;
1133
    		}
1134
    		$stack[] = $result; $result = $this->construct( $matchrule, "String" ); 
1135
    		if (( $subres = $this->rx( '/ (\\\\\\\\ | \\\\. | [^'.$this->expression($result, $stack, 'q').'\\\\])* /' ) ) !== FALSE) {
1136
    			$result["text"] .= $subres;
1137
    			$subres = $result; $result = array_pop($stack);
1138
    			$this->store( $result, $subres, 'String' );
1139
    		}
1140
    		else {
1141
    			$result = array_pop($stack);
1142
    			$_143 = FALSE; break;
1143
    		}
1144
    		if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'q').'' ) ) !== FALSE) { $result["text"] .= $subres; }
1145
    		else { $_143 = FALSE; break; }
1146
    		$_143 = TRUE; break;
1147
    	}
1148
    	while(0);
1149
    	if( $_143 === TRUE ) { return $this->finalise($result); }
1150
    	if( $_143 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_143 === FALSE is always true.
Loading history...
1151
    }
1152
1153
1154
    /* Null: / (null)\b /i */
1155
    protected $match_Null_typestack = array('Null');
1156
    function match_Null ($stack = array()) {
1157
    	$matchrule = "Null"; $result = $this->construct($matchrule, $matchrule, null);
1158
    	if (( $subres = $this->rx( '/ (null)\b /i' ) ) !== FALSE) {
1159
    		$result["text"] .= $subres;
1160
    		return $this->finalise($result);
1161
    	}
1162
    	else { return FALSE; }
1163
    }
1164
1165
1166
    /* Boolean: / (true|false)\b  /i */
1167
    protected $match_Boolean_typestack = array('Boolean');
1168
    function match_Boolean ($stack = array()) {
1169
    	$matchrule = "Boolean"; $result = $this->construct($matchrule, $matchrule, null);
1170
    	if (( $subres = $this->rx( '/ (true|false)\b  /i' ) ) !== FALSE) {
1171
    		$result["text"] .= $subres;
1172
    		return $this->finalise($result);
1173
    	}
1174
    	else { return FALSE; }
1175
    }
1176
1177
1178
    /* Sign: / [+-] / */
1179
    protected $match_Sign_typestack = array('Sign');
1180
    function match_Sign ($stack = array()) {
1181
    	$matchrule = "Sign"; $result = $this->construct($matchrule, $matchrule, null);
1182
    	if (( $subres = $this->rx( '/ [+-] /' ) ) !== FALSE) {
1183
    		$result["text"] .= $subres;
1184
    		return $this->finalise($result);
1185
    	}
1186
    	else { return FALSE; }
1187
    }
1188
1189
1190
    /* Float: / [0-9]*\.?[0-9]+([eE][-+]?[0-9]+)? / */
1191
    protected $match_Float_typestack = array('Float');
1192
    function match_Float ($stack = array()) {
1193
    	$matchrule = "Float"; $result = $this->construct($matchrule, $matchrule, null);
1194
    	if (( $subres = $this->rx( '/ [0-9]*\.?[0-9]+([eE][-+]?[0-9]+)? /' ) ) !== FALSE) {
1195
    		$result["text"] .= $subres;
1196
    		return $this->finalise($result);
1197
    	}
1198
    	else { return FALSE; }
1199
    }
1200
1201
1202
    /* Hexadecimal: / 0[xX][0-9a-fA-F]+ / */
1203
    protected $match_Hexadecimal_typestack = array('Hexadecimal');
1204
    function match_Hexadecimal ($stack = array()) {
1205
    	$matchrule = "Hexadecimal"; $result = $this->construct($matchrule, $matchrule, null);
1206
    	if (( $subres = $this->rx( '/ 0[xX][0-9a-fA-F]+ /' ) ) !== FALSE) {
1207
    		$result["text"] .= $subres;
1208
    		return $this->finalise($result);
1209
    	}
1210
    	else { return FALSE; }
1211
    }
1212
1213
1214
    /* Octal: / 0[0-7]+ / */
1215
    protected $match_Octal_typestack = array('Octal');
1216
    function match_Octal ($stack = array()) {
1217
    	$matchrule = "Octal"; $result = $this->construct($matchrule, $matchrule, null);
1218
    	if (( $subres = $this->rx( '/ 0[0-7]+ /' ) ) !== FALSE) {
1219
    		$result["text"] .= $subres;
1220
    		return $this->finalise($result);
1221
    	}
1222
    	else { return FALSE; }
1223
    }
1224
1225
1226
    /* Binary: / 0[bB][01]+ / */
1227
    protected $match_Binary_typestack = array('Binary');
1228
    function match_Binary ($stack = array()) {
1229
    	$matchrule = "Binary"; $result = $this->construct($matchrule, $matchrule, null);
1230
    	if (( $subres = $this->rx( '/ 0[bB][01]+ /' ) ) !== FALSE) {
1231
    		$result["text"] .= $subres;
1232
    		return $this->finalise($result);
1233
    	}
1234
    	else { return FALSE; }
1235
    }
1236
1237
1238
    /* Decimal: / 0 | [1-9][0-9]* / */
1239
    protected $match_Decimal_typestack = array('Decimal');
1240
    function match_Decimal ($stack = array()) {
1241
    	$matchrule = "Decimal"; $result = $this->construct($matchrule, $matchrule, null);
1242
    	if (( $subres = $this->rx( '/ 0 | [1-9][0-9]* /' ) ) !== FALSE) {
1243
    		$result["text"] .= $subres;
1244
    		return $this->finalise($result);
1245
    	}
1246
    	else { return FALSE; }
1247
    }
1248
1249
1250
    /* IntegerOrFloat: ( Sign )? ( Hexadecimal | Binary | Float | Octal | Decimal ) */
1251
    protected $match_IntegerOrFloat_typestack = array('IntegerOrFloat');
1252
    function match_IntegerOrFloat ($stack = array()) {
1253
    	$matchrule = "IntegerOrFloat"; $result = $this->construct($matchrule, $matchrule, null);
1254
    	$_175 = NULL;
1255
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
1256
    		$res_155 = $result;
1257
    		$pos_155 = $this->pos;
1258
    		$_154 = NULL;
1259
    		do {
1260
    			$matcher = 'match_'.'Sign'; $key = $matcher; $pos = $this->pos;
1261
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1262
    			if ($subres !== FALSE) {
1263
    				$this->store( $result, $subres );
1264
    			}
1265
    			else { $_154 = FALSE; break; }
1266
    			$_154 = TRUE; break;
1267
    		}
1268
    		while(0);
1269
    		if( $_154 === FALSE) {
1270
    			$result = $res_155;
1271
    			$this->pos = $pos_155;
1272
    			unset( $res_155 );
1273
    			unset( $pos_155 );
1274
    		}
1275
    		$_173 = NULL;
1276
    		do {
1277
    			$_171 = NULL;
1278
    			do {
1279
    				$res_156 = $result;
1280
    				$pos_156 = $this->pos;
1281
    				$matcher = 'match_'.'Hexadecimal'; $key = $matcher; $pos = $this->pos;
1282
    				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1283
    				if ($subres !== FALSE) {
1284
    					$this->store( $result, $subres );
1285
    					$_171 = TRUE; break;
1286
    				}
1287
    				$result = $res_156;
1288
    				$this->pos = $pos_156;
1289
    				$_169 = NULL;
1290
    				do {
1291
    					$res_158 = $result;
1292
    					$pos_158 = $this->pos;
1293
    					$matcher = 'match_'.'Binary'; $key = $matcher; $pos = $this->pos;
1294
    					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1295
    					if ($subres !== FALSE) {
1296
    						$this->store( $result, $subres );
1297
    						$_169 = TRUE; break;
1298
    					}
1299
    					$result = $res_158;
1300
    					$this->pos = $pos_158;
1301
    					$_167 = NULL;
1302
    					do {
1303
    						$res_160 = $result;
1304
    						$pos_160 = $this->pos;
1305
    						$matcher = 'match_'.'Float'; $key = $matcher; $pos = $this->pos;
1306
    						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1307
    						if ($subres !== FALSE) {
1308
    							$this->store( $result, $subres );
1309
    							$_167 = TRUE; break;
1310
    						}
1311
    						$result = $res_160;
1312
    						$this->pos = $pos_160;
1313
    						$_165 = NULL;
1314
    						do {
1315
    							$res_162 = $result;
1316
    							$pos_162 = $this->pos;
1317
    							$matcher = 'match_'.'Octal'; $key = $matcher; $pos = $this->pos;
1318
    							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1319
    							if ($subres !== FALSE) {
1320
    								$this->store( $result, $subres );
1321
    								$_165 = TRUE; break;
1322
    							}
1323
    							$result = $res_162;
1324
    							$this->pos = $pos_162;
1325
    							$matcher = 'match_'.'Decimal'; $key = $matcher; $pos = $this->pos;
1326
    							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1327
    							if ($subres !== FALSE) {
1328
    								$this->store( $result, $subres );
1329
    								$_165 = TRUE; break;
1330
    							}
1331
    							$result = $res_162;
1332
    							$this->pos = $pos_162;
1333
    							$_165 = FALSE; break;
1334
    						}
1335
    						while(0);
1336
    						if( $_165 === TRUE ) { $_167 = TRUE; break; }
1337
    						$result = $res_160;
1338
    						$this->pos = $pos_160;
1339
    						$_167 = FALSE; break;
1340
    					}
1341
    					while(0);
1342
    					if( $_167 === TRUE ) { $_169 = TRUE; break; }
1343
    					$result = $res_158;
1344
    					$this->pos = $pos_158;
1345
    					$_169 = FALSE; break;
1346
    				}
1347
    				while(0);
1348
    				if( $_169 === TRUE ) { $_171 = TRUE; break; }
1349
    				$result = $res_156;
1350
    				$this->pos = $pos_156;
1351
    				$_171 = FALSE; break;
1352
    			}
1353
    			while(0);
1354
    			if( $_171 === FALSE) { $_173 = FALSE; break; }
1355
    			$_173 = TRUE; break;
1356
    		}
1357
    		while(0);
1358
    		if( $_173 === FALSE) { $_175 = FALSE; break; }
1359
    		$_175 = TRUE; break;
1360
    	}
1361
    	while(0);
1362
    	if( $_175 === TRUE ) { return $this->finalise($result); }
1363
    	if( $_175 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_175 === FALSE is always true.
Loading history...
1364
    }
1365
1366
1367
    /* FreeString: /[^,)%!=><|&]+/ */
1368
    protected $match_FreeString_typestack = array('FreeString');
1369
    function match_FreeString ($stack = array()) {
1370
    	$matchrule = "FreeString"; $result = $this->construct($matchrule, $matchrule, null);
1371
    	if (( $subres = $this->rx( '/[^,)%!=><|&]+/' ) ) !== FALSE) {
1372
    		$result["text"] .= $subres;
1373
    		return $this->finalise($result);
1374
    	}
1375
    	else { return FALSE; }
1376
    }
1377
1378
1379
    /* Argument:
1380
    :DollarMarkedLookup |
1381
    :QuotedString |
1382
    :Null |
1383
    :Boolean |
1384
    :IntegerOrFloat |
1385
    :Lookup !(< FreeString)|
1386
    :FreeString */
1387
    protected $match_Argument_typestack = array('Argument');
1388
    function match_Argument ($stack = array()) {
1389
    	$matchrule = "Argument"; $result = $this->construct($matchrule, $matchrule, null);
1390
    	$_207 = NULL;
1391
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
1392
    		$res_178 = $result;
1393
    		$pos_178 = $this->pos;
1394
    		$matcher = 'match_'.'DollarMarkedLookup'; $key = $matcher; $pos = $this->pos;
1395
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1396
    		if ($subres !== FALSE) {
1397
    			$this->store( $result, $subres, "DollarMarkedLookup" );
1398
    			$_207 = TRUE; break;
1399
    		}
1400
    		$result = $res_178;
1401
    		$this->pos = $pos_178;
1402
    		$_205 = NULL;
1403
    		do {
1404
    			$res_180 = $result;
1405
    			$pos_180 = $this->pos;
1406
    			$matcher = 'match_'.'QuotedString'; $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) {
1409
    				$this->store( $result, $subres, "QuotedString" );
1410
    				$_205 = TRUE; break;
1411
    			}
1412
    			$result = $res_180;
1413
    			$this->pos = $pos_180;
1414
    			$_203 = NULL;
1415
    			do {
1416
    				$res_182 = $result;
1417
    				$pos_182 = $this->pos;
1418
    				$matcher = 'match_'.'Null'; $key = $matcher; $pos = $this->pos;
1419
    				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1420
    				if ($subres !== FALSE) {
1421
    					$this->store( $result, $subres, "Null" );
1422
    					$_203 = TRUE; break;
1423
    				}
1424
    				$result = $res_182;
1425
    				$this->pos = $pos_182;
1426
    				$_201 = NULL;
1427
    				do {
1428
    					$res_184 = $result;
1429
    					$pos_184 = $this->pos;
1430
    					$matcher = 'match_'.'Boolean'; $key = $matcher; $pos = $this->pos;
1431
    					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1432
    					if ($subres !== FALSE) {
1433
    						$this->store( $result, $subres, "Boolean" );
1434
    						$_201 = TRUE; break;
1435
    					}
1436
    					$result = $res_184;
1437
    					$this->pos = $pos_184;
1438
    					$_199 = NULL;
1439
    					do {
1440
    						$res_186 = $result;
1441
    						$pos_186 = $this->pos;
1442
    						$matcher = 'match_'.'IntegerOrFloat'; $key = $matcher; $pos = $this->pos;
1443
    						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1444
    						if ($subres !== FALSE) {
1445
    							$this->store( $result, $subres, "IntegerOrFloat" );
1446
    							$_199 = TRUE; break;
1447
    						}
1448
    						$result = $res_186;
1449
    						$this->pos = $pos_186;
1450
    						$_197 = NULL;
1451
    						do {
1452
    							$res_188 = $result;
1453
    							$pos_188 = $this->pos;
1454
    							$_194 = NULL;
1455
    							do {
1456
    								$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
1457
    								$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1458
    								if ($subres !== FALSE) {
1459
    									$this->store( $result, $subres, "Lookup" );
1460
    								}
1461
    								else { $_194 = FALSE; break; }
1462
    								$res_193 = $result;
1463
    								$pos_193 = $this->pos;
1464
    								$_192 = NULL;
1465
    								do {
1466
    									if (( $subres = $this->whitespace(  ) ) !== FALSE) {
1467
    										$result["text"] .= $subres;
1468
    									}
1469
    									$matcher = 'match_'.'FreeString'; $key = $matcher; $pos = $this->pos;
1470
    									$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1471
    									if ($subres !== FALSE) {
1472
    										$this->store( $result, $subres );
1473
    									}
1474
    									else { $_192 = FALSE; break; }
1475
    									$_192 = TRUE; break;
1476
    								}
1477
    								while(0);
1478
    								if( $_192 === TRUE ) {
1479
    									$result = $res_193;
1480
    									$this->pos = $pos_193;
1481
    									$_194 = FALSE; break;
1482
    								}
1483
    								if( $_192 === FALSE) {
1484
    									$result = $res_193;
1485
    									$this->pos = $pos_193;
1486
    								}
1487
    								$_194 = TRUE; break;
1488
    							}
1489
    							while(0);
1490
    							if( $_194 === TRUE ) { $_197 = TRUE; break; }
1491
    							$result = $res_188;
1492
    							$this->pos = $pos_188;
1493
    							$matcher = 'match_'.'FreeString'; $key = $matcher; $pos = $this->pos;
1494
    							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1495
    							if ($subres !== FALSE) {
1496
    								$this->store( $result, $subres, "FreeString" );
1497
    								$_197 = TRUE; break;
1498
    							}
1499
    							$result = $res_188;
1500
    							$this->pos = $pos_188;
1501
    							$_197 = FALSE; break;
1502
    						}
1503
    						while(0);
1504
    						if( $_197 === TRUE ) { $_199 = TRUE; break; }
1505
    						$result = $res_186;
1506
    						$this->pos = $pos_186;
1507
    						$_199 = FALSE; break;
1508
    					}
1509
    					while(0);
1510
    					if( $_199 === TRUE ) { $_201 = TRUE; break; }
1511
    					$result = $res_184;
1512
    					$this->pos = $pos_184;
1513
    					$_201 = FALSE; break;
1514
    				}
1515
    				while(0);
1516
    				if( $_201 === TRUE ) { $_203 = TRUE; break; }
1517
    				$result = $res_182;
1518
    				$this->pos = $pos_182;
1519
    				$_203 = FALSE; break;
1520
    			}
1521
    			while(0);
1522
    			if( $_203 === TRUE ) { $_205 = TRUE; break; }
1523
    			$result = $res_180;
1524
    			$this->pos = $pos_180;
1525
    			$_205 = FALSE; break;
1526
    		}
1527
    		while(0);
1528
    		if( $_205 === TRUE ) { $_207 = TRUE; break; }
1529
    		$result = $res_178;
1530
    		$this->pos = $pos_178;
1531
    		$_207 = FALSE; break;
1532
    	}
1533
    	while(0);
1534
    	if( $_207 === TRUE ) { return $this->finalise($result); }
1535
    	if( $_207 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_207 === FALSE is always true.
Loading history...
1536
    }
1537
1538
1539
1540
1541
    /**
1542
     * If we get a bare value, we don't know enough to determine exactly what php would be the translation, because
1543
     * we don't know if the position of use indicates a lookup or a string argument.
1544
     *
1545
     * Instead, we record 'ArgumentMode' as a member of this matches results node, which can be:
1546
     *   - lookup if this argument was unambiguously a lookup (marked as such)
1547
     *   - string is this argument was unambiguously a string (marked as such, or impossible to parse as lookup)
1548
     *   - default if this argument needs to be handled as per 2.4
1549
     *
1550
     * In the case of 'default', there is no php member of the results node, but instead 'lookup_php', which
1551
     * should be used by the parent if the context indicates a lookup, and 'string_php' which should be used
1552
     * if the context indicates a string
1553
     */
1554
1555
    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...
1556
    {
1557
        $res['ArgumentMode'] = 'lookup';
1558
        $res['php'] = $sub['Lookup']['php'];
1559
    }
1560
1561
    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...
1562
    {
1563
        $res['ArgumentMode'] = 'string';
1564
        $res['php'] = "'" . str_replace("'", "\\'", $sub['String']['text']) . "'";
1565
    }
1566
1567
    function Argument_Null(&$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...
1568
    {
1569
        $res['ArgumentMode'] = 'string';
1570
        $res['php'] = $sub['text'];
1571
    }
1572
1573
    function Argument_Boolean(&$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...
1574
    {
1575
        $res['ArgumentMode'] = 'string';
1576
        $res['php'] = $sub['text'];
1577
    }
1578
1579
    function Argument_IntegerOrFloat(&$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...
1580
    {
1581
        $res['ArgumentMode'] = 'string';
1582
        $res['php'] = $sub['text'];
1583
    }
1584
1585
    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...
1586
    {
1587
        if (count($sub['LookupSteps']) == 1 && !isset($sub['LookupSteps'][0]['Call']['Arguments'])) {
1588
            $res['ArgumentMode'] = 'default';
1589
            $res['lookup_php'] = $sub['php'];
1590
            $res['string_php'] = "'".$sub['LookupSteps'][0]['Call']['Method']['text']."'";
1591
        } else {
1592
            $res['ArgumentMode'] = 'lookup';
1593
            $res['php'] = $sub['php'];
1594
        }
1595
    }
1596
1597
    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...
1598
    {
1599
        $res['ArgumentMode'] = 'string';
1600
        $res['php'] = "'" . str_replace("'", "\\'", trim($sub['text'])) . "'";
1601
    }
1602
1603
    /* ComparisonOperator: "!=" | "==" | ">=" | ">" | "<=" | "<" | "=" */
1604
    protected $match_ComparisonOperator_typestack = array('ComparisonOperator');
1605
    function match_ComparisonOperator ($stack = array()) {
1606
    	$matchrule = "ComparisonOperator"; $result = $this->construct($matchrule, $matchrule, null);
1607
    	$_232 = NULL;
1608
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
1609
    		$res_209 = $result;
1610
    		$pos_209 = $this->pos;
1611
    		if (( $subres = $this->literal( '!=' ) ) !== FALSE) {
1612
    			$result["text"] .= $subres;
1613
    			$_232 = TRUE; break;
1614
    		}
1615
    		$result = $res_209;
1616
    		$this->pos = $pos_209;
1617
    		$_230 = NULL;
1618
    		do {
1619
    			$res_211 = $result;
1620
    			$pos_211 = $this->pos;
1621
    			if (( $subres = $this->literal( '==' ) ) !== FALSE) {
1622
    				$result["text"] .= $subres;
1623
    				$_230 = TRUE; break;
1624
    			}
1625
    			$result = $res_211;
1626
    			$this->pos = $pos_211;
1627
    			$_228 = NULL;
1628
    			do {
1629
    				$res_213 = $result;
1630
    				$pos_213 = $this->pos;
1631
    				if (( $subres = $this->literal( '>=' ) ) !== FALSE) {
1632
    					$result["text"] .= $subres;
1633
    					$_228 = TRUE; break;
1634
    				}
1635
    				$result = $res_213;
1636
    				$this->pos = $pos_213;
1637
    				$_226 = NULL;
1638
    				do {
1639
    					$res_215 = $result;
1640
    					$pos_215 = $this->pos;
1641
    					if (substr($this->string,$this->pos,1) == '>') {
1642
    						$this->pos += 1;
1643
    						$result["text"] .= '>';
1644
    						$_226 = TRUE; break;
1645
    					}
1646
    					$result = $res_215;
1647
    					$this->pos = $pos_215;
1648
    					$_224 = NULL;
1649
    					do {
1650
    						$res_217 = $result;
1651
    						$pos_217 = $this->pos;
1652
    						if (( $subres = $this->literal( '<=' ) ) !== FALSE) {
1653
    							$result["text"] .= $subres;
1654
    							$_224 = TRUE; break;
1655
    						}
1656
    						$result = $res_217;
1657
    						$this->pos = $pos_217;
1658
    						$_222 = NULL;
1659
    						do {
1660
    							$res_219 = $result;
1661
    							$pos_219 = $this->pos;
1662
    							if (substr($this->string,$this->pos,1) == '<') {
1663
    								$this->pos += 1;
1664
    								$result["text"] .= '<';
1665
    								$_222 = TRUE; break;
1666
    							}
1667
    							$result = $res_219;
1668
    							$this->pos = $pos_219;
1669
    							if (substr($this->string,$this->pos,1) == '=') {
1670
    								$this->pos += 1;
1671
    								$result["text"] .= '=';
1672
    								$_222 = TRUE; break;
1673
    							}
1674
    							$result = $res_219;
1675
    							$this->pos = $pos_219;
1676
    							$_222 = FALSE; break;
1677
    						}
1678
    						while(0);
1679
    						if( $_222 === TRUE ) { $_224 = TRUE; break; }
1680
    						$result = $res_217;
1681
    						$this->pos = $pos_217;
1682
    						$_224 = FALSE; break;
1683
    					}
1684
    					while(0);
1685
    					if( $_224 === TRUE ) { $_226 = TRUE; break; }
1686
    					$result = $res_215;
1687
    					$this->pos = $pos_215;
1688
    					$_226 = FALSE; break;
1689
    				}
1690
    				while(0);
1691
    				if( $_226 === TRUE ) { $_228 = TRUE; break; }
1692
    				$result = $res_213;
1693
    				$this->pos = $pos_213;
1694
    				$_228 = FALSE; break;
1695
    			}
1696
    			while(0);
1697
    			if( $_228 === TRUE ) { $_230 = TRUE; break; }
1698
    			$result = $res_211;
1699
    			$this->pos = $pos_211;
1700
    			$_230 = FALSE; break;
1701
    		}
1702
    		while(0);
1703
    		if( $_230 === TRUE ) { $_232 = TRUE; break; }
1704
    		$result = $res_209;
1705
    		$this->pos = $pos_209;
1706
    		$_232 = FALSE; break;
1707
    	}
1708
    	while(0);
1709
    	if( $_232 === TRUE ) { return $this->finalise($result); }
1710
    	if( $_232 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_232 === FALSE is always true.
Loading history...
1711
    }
1712
1713
1714
    /* Comparison: Argument < ComparisonOperator > Argument */
1715
    protected $match_Comparison_typestack = array('Comparison');
1716
    function match_Comparison ($stack = array()) {
1717
    	$matchrule = "Comparison"; $result = $this->construct($matchrule, $matchrule, null);
1718
    	$_239 = NULL;
1719
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
1720
    		$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
1721
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1722
    		if ($subres !== FALSE) {
1723
    			$this->store( $result, $subres );
1724
    		}
1725
    		else { $_239 = FALSE; break; }
1726
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1727
    		$matcher = 'match_'.'ComparisonOperator'; $key = $matcher; $pos = $this->pos;
1728
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1729
    		if ($subres !== FALSE) {
1730
    			$this->store( $result, $subres );
1731
    		}
1732
    		else { $_239 = FALSE; break; }
1733
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1734
    		$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
1735
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1736
    		if ($subres !== FALSE) {
1737
    			$this->store( $result, $subres );
1738
    		}
1739
    		else { $_239 = FALSE; break; }
1740
    		$_239 = TRUE; break;
1741
    	}
1742
    	while(0);
1743
    	if( $_239 === TRUE ) { return $this->finalise($result); }
1744
    	if( $_239 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_239 === FALSE is always true.
Loading history...
1745
    }
1746
1747
1748
1749
    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...
1750
    {
1751
        if ($sub['ArgumentMode'] == 'default') {
1752
            if (!empty($res['php'])) {
1753
                $res['php'] .= $sub['string_php'];
1754
            } else {
1755
                $res['php'] = str_replace('$$FINAL', 'XML_val', $sub['lookup_php']);
1756
            }
1757
        } else {
1758
            $res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']);
1759
        }
1760
    }
1761
1762
    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...
1763
    {
1764
        $res['php'] .= ($sub['text'] == '=' ? '==' : $sub['text']);
1765
    }
1766
1767
    /* PresenceCheck: (Not:'not' <)? Argument */
1768
    protected $match_PresenceCheck_typestack = array('PresenceCheck');
1769
    function match_PresenceCheck ($stack = array()) {
1770
    	$matchrule = "PresenceCheck"; $result = $this->construct($matchrule, $matchrule, null);
1771
    	$_246 = NULL;
1772
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
1773
    		$res_244 = $result;
1774
    		$pos_244 = $this->pos;
1775
    		$_243 = NULL;
1776
    		do {
1777
    			$stack[] = $result; $result = $this->construct( $matchrule, "Not" ); 
1778
    			if (( $subres = $this->literal( 'not' ) ) !== FALSE) {
1779
    				$result["text"] .= $subres;
1780
    				$subres = $result; $result = array_pop($stack);
1781
    				$this->store( $result, $subres, 'Not' );
1782
    			}
1783
    			else {
1784
    				$result = array_pop($stack);
1785
    				$_243 = FALSE; break;
1786
    			}
1787
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1788
    			$_243 = TRUE; break;
1789
    		}
1790
    		while(0);
1791
    		if( $_243 === FALSE) {
1792
    			$result = $res_244;
1793
    			$this->pos = $pos_244;
1794
    			unset( $res_244 );
1795
    			unset( $pos_244 );
1796
    		}
1797
    		$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
1798
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1799
    		if ($subres !== FALSE) {
1800
    			$this->store( $result, $subres );
1801
    		}
1802
    		else { $_246 = FALSE; break; }
1803
    		$_246 = TRUE; break;
1804
    	}
1805
    	while(0);
1806
    	if( $_246 === TRUE ) { return $this->finalise($result); }
1807
    	if( $_246 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_246 === FALSE is always true.
Loading history...
1808
    }
1809
1810
1811
1812
    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...
1813
    {
1814
        $res['php'] = '!';
1815
    }
1816
1817
    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...
1818
    {
1819
        if ($sub['ArgumentMode'] == 'string') {
1820
            $res['php'] .= '((bool)'.$sub['php'].')';
1821
        } else {
1822
            $php = ($sub['ArgumentMode'] == 'default' ? $sub['lookup_php'] : $sub['php']);
1823
            // TODO: kinda hacky - maybe we need a way to pass state down the parse chain so
1824
            // Lookup_LastLookupStep and Argument_BareWord can produce hasValue instead of XML_val
1825
            $res['php'] .= str_replace('$$FINAL', 'hasValue', $php);
1826
        }
1827
    }
1828
1829
    /* IfArgumentPortion: Comparison | PresenceCheck */
1830
    protected $match_IfArgumentPortion_typestack = array('IfArgumentPortion');
1831
    function match_IfArgumentPortion ($stack = array()) {
1832
    	$matchrule = "IfArgumentPortion"; $result = $this->construct($matchrule, $matchrule, null);
1833
    	$_251 = NULL;
1834
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
1835
    		$res_248 = $result;
1836
    		$pos_248 = $this->pos;
1837
    		$matcher = 'match_'.'Comparison'; $key = $matcher; $pos = $this->pos;
1838
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1839
    		if ($subres !== FALSE) {
1840
    			$this->store( $result, $subres );
1841
    			$_251 = TRUE; break;
1842
    		}
1843
    		$result = $res_248;
1844
    		$this->pos = $pos_248;
1845
    		$matcher = 'match_'.'PresenceCheck'; $key = $matcher; $pos = $this->pos;
1846
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1847
    		if ($subres !== FALSE) {
1848
    			$this->store( $result, $subres );
1849
    			$_251 = TRUE; break;
1850
    		}
1851
    		$result = $res_248;
1852
    		$this->pos = $pos_248;
1853
    		$_251 = FALSE; break;
1854
    	}
1855
    	while(0);
1856
    	if( $_251 === TRUE ) { return $this->finalise($result); }
1857
    	if( $_251 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_251 === FALSE is always true.
Loading history...
1858
    }
1859
1860
1861
1862
    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...
1863
    {
1864
        $res['php'] = $sub['php'];
1865
    }
1866
1867
    /* BooleanOperator: "||" | "&&" */
1868
    protected $match_BooleanOperator_typestack = array('BooleanOperator');
1869
    function match_BooleanOperator ($stack = array()) {
1870
    	$matchrule = "BooleanOperator"; $result = $this->construct($matchrule, $matchrule, null);
1871
    	$_256 = NULL;
1872
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
1873
    		$res_253 = $result;
1874
    		$pos_253 = $this->pos;
1875
    		if (( $subres = $this->literal( '||' ) ) !== FALSE) {
1876
    			$result["text"] .= $subres;
1877
    			$_256 = TRUE; break;
1878
    		}
1879
    		$result = $res_253;
1880
    		$this->pos = $pos_253;
1881
    		if (( $subres = $this->literal( '&&' ) ) !== FALSE) {
1882
    			$result["text"] .= $subres;
1883
    			$_256 = TRUE; break;
1884
    		}
1885
    		$result = $res_253;
1886
    		$this->pos = $pos_253;
1887
    		$_256 = FALSE; break;
1888
    	}
1889
    	while(0);
1890
    	if( $_256 === TRUE ) { return $this->finalise($result); }
1891
    	if( $_256 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_256 === FALSE is always true.
Loading history...
1892
    }
1893
1894
1895
    /* IfArgument: :IfArgumentPortion ( < :BooleanOperator < :IfArgumentPortion )* */
1896
    protected $match_IfArgument_typestack = array('IfArgument');
1897
    function match_IfArgument ($stack = array()) {
1898
    	$matchrule = "IfArgument"; $result = $this->construct($matchrule, $matchrule, null);
1899
    	$_265 = NULL;
1900
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
1901
    		$matcher = 'match_'.'IfArgumentPortion'; $key = $matcher; $pos = $this->pos;
1902
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1903
    		if ($subres !== FALSE) {
1904
    			$this->store( $result, $subres, "IfArgumentPortion" );
1905
    		}
1906
    		else { $_265 = FALSE; break; }
1907
    		while (true) {
1908
    			$res_264 = $result;
1909
    			$pos_264 = $this->pos;
1910
    			$_263 = NULL;
1911
    			do {
1912
    				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1913
    				$matcher = 'match_'.'BooleanOperator'; $key = $matcher; $pos = $this->pos;
1914
    				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1915
    				if ($subres !== FALSE) {
1916
    					$this->store( $result, $subres, "BooleanOperator" );
1917
    				}
1918
    				else { $_263 = FALSE; break; }
1919
    				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1920
    				$matcher = 'match_'.'IfArgumentPortion'; $key = $matcher; $pos = $this->pos;
1921
    				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1922
    				if ($subres !== FALSE) {
1923
    					$this->store( $result, $subres, "IfArgumentPortion" );
1924
    				}
1925
    				else { $_263 = FALSE; break; }
1926
    				$_263 = TRUE; break;
1927
    			}
1928
    			while(0);
1929
    			if( $_263 === FALSE) {
1930
    				$result = $res_264;
1931
    				$this->pos = $pos_264;
1932
    				unset( $res_264 );
1933
    				unset( $pos_264 );
1934
    				break;
1935
    			}
1936
    		}
1937
    		$_265 = TRUE; break;
1938
    	}
1939
    	while(0);
1940
    	if( $_265 === TRUE ) { return $this->finalise($result); }
1941
    	if( $_265 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_265 === FALSE is always true.
Loading history...
1942
    }
1943
1944
1945
1946
    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...
1947
    {
1948
        $res['php'] .= $sub['php'];
1949
    }
1950
1951
    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...
1952
    {
1953
        $res['php'] .= $sub['text'];
1954
    }
1955
1956
    /* IfPart: '<%' < 'if' [ :IfArgument > '%>' Template:$TemplateMatcher? */
1957
    protected $match_IfPart_typestack = array('IfPart');
1958
    function match_IfPart ($stack = array()) {
1959
    	$matchrule = "IfPart"; $result = $this->construct($matchrule, $matchrule, null);
1960
    	$_275 = NULL;
1961
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
1962
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
1963
    		else { $_275 = FALSE; break; }
1964
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1965
    		if (( $subres = $this->literal( 'if' ) ) !== FALSE) { $result["text"] .= $subres; }
1966
    		else { $_275 = FALSE; break; }
1967
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1968
    		else { $_275 = FALSE; break; }
1969
    		$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos;
1970
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1971
    		if ($subres !== FALSE) {
1972
    			$this->store( $result, $subres, "IfArgument" );
1973
    		}
1974
    		else { $_275 = FALSE; break; }
1975
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
1976
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
1977
    		else { $_275 = FALSE; break; }
1978
    		$res_274 = $result;
1979
    		$pos_274 = $this->pos;
1980
    		$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
1981
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
1982
    		if ($subres !== FALSE) {
1983
    			$this->store( $result, $subres, "Template" );
1984
    		}
1985
    		else {
1986
    			$result = $res_274;
1987
    			$this->pos = $pos_274;
1988
    			unset( $res_274 );
1989
    			unset( $pos_274 );
1990
    		}
1991
    		$_275 = TRUE; break;
1992
    	}
1993
    	while(0);
1994
    	if( $_275 === TRUE ) { return $this->finalise($result); }
1995
    	if( $_275 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_275 === FALSE is always true.
Loading history...
1996
    }
1997
1998
1999
    /* ElseIfPart: '<%' < 'else_if' [ :IfArgument > '%>' Template:$TemplateMatcher? */
2000
    protected $match_ElseIfPart_typestack = array('ElseIfPart');
2001
    function match_ElseIfPart ($stack = array()) {
2002
    	$matchrule = "ElseIfPart"; $result = $this->construct($matchrule, $matchrule, null);
2003
    	$_285 = NULL;
2004
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
2005
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
2006
    		else { $_285 = FALSE; break; }
2007
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2008
    		if (( $subres = $this->literal( 'else_if' ) ) !== FALSE) { $result["text"] .= $subres; }
2009
    		else { $_285 = FALSE; break; }
2010
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2011
    		else { $_285 = FALSE; break; }
2012
    		$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos;
2013
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2014
    		if ($subres !== FALSE) {
2015
    			$this->store( $result, $subres, "IfArgument" );
2016
    		}
2017
    		else { $_285 = FALSE; break; }
2018
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2019
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
2020
    		else { $_285 = FALSE; break; }
2021
    		$res_284 = $result;
2022
    		$pos_284 = $this->pos;
2023
    		$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
2024
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2025
    		if ($subres !== FALSE) {
2026
    			$this->store( $result, $subres, "Template" );
2027
    		}
2028
    		else {
2029
    			$result = $res_284;
2030
    			$this->pos = $pos_284;
2031
    			unset( $res_284 );
2032
    			unset( $pos_284 );
2033
    		}
2034
    		$_285 = TRUE; break;
2035
    	}
2036
    	while(0);
2037
    	if( $_285 === TRUE ) { return $this->finalise($result); }
2038
    	if( $_285 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_285 === FALSE is always true.
Loading history...
2039
    }
2040
2041
2042
    /* ElsePart: '<%' < 'else' > '%>' Template:$TemplateMatcher? */
2043
    protected $match_ElsePart_typestack = array('ElsePart');
2044
    function match_ElsePart ($stack = array()) {
2045
    	$matchrule = "ElsePart"; $result = $this->construct($matchrule, $matchrule, null);
2046
    	$_293 = NULL;
2047
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
2048
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
2049
    		else { $_293 = FALSE; break; }
2050
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2051
    		if (( $subres = $this->literal( 'else' ) ) !== FALSE) { $result["text"] .= $subres; }
2052
    		else { $_293 = FALSE; break; }
2053
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2054
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
2055
    		else { $_293 = FALSE; break; }
2056
    		$res_292 = $result;
2057
    		$pos_292 = $this->pos;
2058
    		$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
2059
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2060
    		if ($subres !== FALSE) {
2061
    			$this->store( $result, $subres, "Template" );
2062
    		}
2063
    		else {
2064
    			$result = $res_292;
2065
    			$this->pos = $pos_292;
2066
    			unset( $res_292 );
2067
    			unset( $pos_292 );
2068
    		}
2069
    		$_293 = TRUE; break;
2070
    	}
2071
    	while(0);
2072
    	if( $_293 === TRUE ) { return $this->finalise($result); }
2073
    	if( $_293 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_293 === FALSE is always true.
Loading history...
2074
    }
2075
2076
2077
    /* If: IfPart ElseIfPart* ElsePart? '<%' < 'end_if' > '%>' */
2078
    protected $match_If_typestack = array('If');
2079
    function match_If ($stack = array()) {
2080
    	$matchrule = "If"; $result = $this->construct($matchrule, $matchrule, null);
2081
    	$_303 = NULL;
2082
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
2083
    		$matcher = 'match_'.'IfPart'; $key = $matcher; $pos = $this->pos;
2084
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2085
    		if ($subres !== FALSE) {
2086
    			$this->store( $result, $subres );
2087
    		}
2088
    		else { $_303 = FALSE; break; }
2089
    		while (true) {
2090
    			$res_296 = $result;
2091
    			$pos_296 = $this->pos;
2092
    			$matcher = 'match_'.'ElseIfPart'; $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
    			}
2097
    			else {
2098
    				$result = $res_296;
2099
    				$this->pos = $pos_296;
2100
    				unset( $res_296 );
2101
    				unset( $pos_296 );
2102
    				break;
2103
    			}
2104
    		}
2105
    		$res_297 = $result;
2106
    		$pos_297 = $this->pos;
2107
    		$matcher = 'match_'.'ElsePart'; $key = $matcher; $pos = $this->pos;
2108
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2109
    		if ($subres !== FALSE) {
2110
    			$this->store( $result, $subres );
2111
    		}
2112
    		else {
2113
    			$result = $res_297;
2114
    			$this->pos = $pos_297;
2115
    			unset( $res_297 );
2116
    			unset( $pos_297 );
2117
    		}
2118
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
2119
    		else { $_303 = FALSE; break; }
2120
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2121
    		if (( $subres = $this->literal( 'end_if' ) ) !== FALSE) { $result["text"] .= $subres; }
2122
    		else { $_303 = FALSE; break; }
2123
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2124
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
2125
    		else { $_303 = FALSE; break; }
2126
    		$_303 = TRUE; break;
2127
    	}
2128
    	while(0);
2129
    	if( $_303 === TRUE ) { return $this->finalise($result); }
2130
    	if( $_303 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_303 === FALSE is always true.
Loading history...
2131
    }
2132
2133
2134
2135
    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...
2136
    {
2137
        $res['php'] =
2138
            'if (' . $sub['IfArgument']['php'] . ') { ' . PHP_EOL .
2139
                (isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL .
2140
            '}';
2141
    }
2142
2143
    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...
2144
    {
2145
        $res['php'] .=
2146
            'else if (' . $sub['IfArgument']['php'] . ') { ' . PHP_EOL .
2147
                (isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL .
2148
            '}';
2149
    }
2150
2151
    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...
2152
    {
2153
        $res['php'] .=
2154
            'else { ' . PHP_EOL .
2155
                (isset($sub['Template']) ? $sub['Template']['php'] : '') . PHP_EOL .
2156
            '}';
2157
    }
2158
2159
    /* Require: '<%' < 'require' [ Call:(Method:Word "(" < :CallArguments  > ")") > '%>' */
2160
    protected $match_Require_typestack = array('Require');
2161
    function match_Require ($stack = array()) {
2162
    	$matchrule = "Require"; $result = $this->construct($matchrule, $matchrule, null);
2163
    	$_319 = NULL;
2164
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
2165
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
2166
    		else { $_319 = FALSE; break; }
2167
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2168
    		if (( $subres = $this->literal( 'require' ) ) !== FALSE) { $result["text"] .= $subres; }
2169
    		else { $_319 = FALSE; break; }
2170
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2171
    		else { $_319 = FALSE; break; }
2172
    		$stack[] = $result; $result = $this->construct( $matchrule, "Call" ); 
2173
    		$_315 = NULL;
2174
    		do {
2175
    			$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
2176
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2177
    			if ($subres !== FALSE) {
2178
    				$this->store( $result, $subres, "Method" );
2179
    			}
2180
    			else { $_315 = FALSE; break; }
2181
    			if (substr($this->string,$this->pos,1) == '(') {
2182
    				$this->pos += 1;
2183
    				$result["text"] .= '(';
2184
    			}
2185
    			else { $_315 = FALSE; break; }
2186
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2187
    			$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
2188
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2189
    			if ($subres !== FALSE) {
2190
    				$this->store( $result, $subres, "CallArguments" );
2191
    			}
2192
    			else { $_315 = FALSE; break; }
2193
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2194
    			if (substr($this->string,$this->pos,1) == ')') {
2195
    				$this->pos += 1;
2196
    				$result["text"] .= ')';
2197
    			}
2198
    			else { $_315 = FALSE; break; }
2199
    			$_315 = TRUE; break;
2200
    		}
2201
    		while(0);
2202
    		if( $_315 === TRUE ) {
2203
    			$subres = $result; $result = array_pop($stack);
2204
    			$this->store( $result, $subres, 'Call' );
2205
    		}
2206
    		if( $_315 === FALSE) {
2207
    			$result = array_pop($stack);
2208
    			$_319 = FALSE; break;
2209
    		}
2210
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2211
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
2212
    		else { $_319 = FALSE; break; }
2213
    		$_319 = TRUE; break;
2214
    	}
2215
    	while(0);
2216
    	if( $_319 === TRUE ) { return $this->finalise($result); }
2217
    	if( $_319 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_319 === FALSE is always true.
Loading history...
2218
    }
2219
2220
2221
2222
    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...
2223
    {
2224
        $requirements = '\\SilverStripe\\View\\Requirements';
2225
        $res['php'] = "{$requirements}::".$sub['Method']['text'].'('.$sub['CallArguments']['php'].');';
2226
    }
2227
2228
2229
    /* CacheBlockArgument:
2230
   !( "if " | "unless " )
2231
    (
2232
        :DollarMarkedLookup |
2233
        :QuotedString |
2234
        :Lookup
2235
    ) */
2236
    protected $match_CacheBlockArgument_typestack = array('CacheBlockArgument');
2237
    function match_CacheBlockArgument ($stack = array()) {
2238
    	$matchrule = "CacheBlockArgument"; $result = $this->construct($matchrule, $matchrule, null);
2239
    	$_339 = NULL;
2240
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
2241
    		$res_327 = $result;
2242
    		$pos_327 = $this->pos;
2243
    		$_326 = NULL;
2244
    		do {
2245
    			$_324 = NULL;
2246
    			do {
2247
    				$res_321 = $result;
2248
    				$pos_321 = $this->pos;
2249
    				if (( $subres = $this->literal( 'if ' ) ) !== FALSE) {
2250
    					$result["text"] .= $subres;
2251
    					$_324 = TRUE; break;
2252
    				}
2253
    				$result = $res_321;
2254
    				$this->pos = $pos_321;
2255
    				if (( $subres = $this->literal( 'unless ' ) ) !== FALSE) {
2256
    					$result["text"] .= $subres;
2257
    					$_324 = TRUE; break;
2258
    				}
2259
    				$result = $res_321;
2260
    				$this->pos = $pos_321;
2261
    				$_324 = FALSE; break;
2262
    			}
2263
    			while(0);
2264
    			if( $_324 === FALSE) { $_326 = FALSE; break; }
2265
    			$_326 = TRUE; break;
2266
    		}
2267
    		while(0);
2268
    		if( $_326 === TRUE ) {
2269
    			$result = $res_327;
2270
    			$this->pos = $pos_327;
2271
    			$_339 = FALSE; break;
2272
    		}
2273
    		if( $_326 === FALSE) {
2274
    			$result = $res_327;
2275
    			$this->pos = $pos_327;
2276
    		}
2277
    		$_337 = NULL;
2278
    		do {
2279
    			$_335 = NULL;
2280
    			do {
2281
    				$res_328 = $result;
2282
    				$pos_328 = $this->pos;
2283
    				$matcher = 'match_'.'DollarMarkedLookup'; $key = $matcher; $pos = $this->pos;
2284
    				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2285
    				if ($subres !== FALSE) {
2286
    					$this->store( $result, $subres, "DollarMarkedLookup" );
2287
    					$_335 = TRUE; break;
2288
    				}
2289
    				$result = $res_328;
2290
    				$this->pos = $pos_328;
2291
    				$_333 = NULL;
2292
    				do {
2293
    					$res_330 = $result;
2294
    					$pos_330 = $this->pos;
2295
    					$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
2296
    					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2297
    					if ($subres !== FALSE) {
2298
    						$this->store( $result, $subres, "QuotedString" );
2299
    						$_333 = TRUE; break;
2300
    					}
2301
    					$result = $res_330;
2302
    					$this->pos = $pos_330;
2303
    					$matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
2304
    					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2305
    					if ($subres !== FALSE) {
2306
    						$this->store( $result, $subres, "Lookup" );
2307
    						$_333 = TRUE; break;
2308
    					}
2309
    					$result = $res_330;
2310
    					$this->pos = $pos_330;
2311
    					$_333 = FALSE; break;
2312
    				}
2313
    				while(0);
2314
    				if( $_333 === TRUE ) { $_335 = TRUE; break; }
2315
    				$result = $res_328;
2316
    				$this->pos = $pos_328;
2317
    				$_335 = FALSE; break;
2318
    			}
2319
    			while(0);
2320
    			if( $_335 === FALSE) { $_337 = FALSE; break; }
2321
    			$_337 = TRUE; break;
2322
    		}
2323
    		while(0);
2324
    		if( $_337 === FALSE) { $_339 = FALSE; break; }
2325
    		$_339 = TRUE; break;
2326
    	}
2327
    	while(0);
2328
    	if( $_339 === TRUE ) { return $this->finalise($result); }
2329
    	if( $_339 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_339 === FALSE is always true.
Loading history...
2330
    }
2331
2332
2333
2334
    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...
2335
    {
2336
        $res['php'] = $sub['Lookup']['php'];
2337
    }
2338
2339
    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...
2340
    {
2341
        $res['php'] = "'" . str_replace("'", "\\'", $sub['String']['text']) . "'";
2342
    }
2343
2344
    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...
2345
    {
2346
        $res['php'] = $sub['php'];
2347
    }
2348
2349
    /* CacheBlockArguments: CacheBlockArgument ( < "," < CacheBlockArgument )* */
2350
    protected $match_CacheBlockArguments_typestack = array('CacheBlockArguments');
2351
    function match_CacheBlockArguments ($stack = array()) {
2352
    	$matchrule = "CacheBlockArguments"; $result = $this->construct($matchrule, $matchrule, null);
2353
    	$_348 = NULL;
2354
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
2355
    		$matcher = 'match_'.'CacheBlockArgument'; $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 );
2359
    		}
2360
    		else { $_348 = FALSE; break; }
2361
    		while (true) {
2362
    			$res_347 = $result;
2363
    			$pos_347 = $this->pos;
2364
    			$_346 = NULL;
2365
    			do {
2366
    				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2367
    				if (substr($this->string,$this->pos,1) == ',') {
2368
    					$this->pos += 1;
2369
    					$result["text"] .= ',';
2370
    				}
2371
    				else { $_346 = FALSE; break; }
2372
    				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2373
    				$matcher = 'match_'.'CacheBlockArgument'; $key = $matcher; $pos = $this->pos;
2374
    				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2375
    				if ($subres !== FALSE) {
2376
    					$this->store( $result, $subres );
2377
    				}
2378
    				else { $_346 = FALSE; break; }
2379
    				$_346 = TRUE; break;
2380
    			}
2381
    			while(0);
2382
    			if( $_346 === FALSE) {
2383
    				$result = $res_347;
2384
    				$this->pos = $pos_347;
2385
    				unset( $res_347 );
2386
    				unset( $pos_347 );
2387
    				break;
2388
    			}
2389
    		}
2390
    		$_348 = TRUE; break;
2391
    	}
2392
    	while(0);
2393
    	if( $_348 === TRUE ) { return $this->finalise($result); }
2394
    	if( $_348 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_348 === FALSE is always true.
Loading history...
2395
    }
2396
2397
2398
2399
    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...
2400
    {
2401
        if (!empty($res['php'])) {
2402
            $res['php'] .= ".'_'.";
2403
        } else {
2404
            $res['php'] = '';
2405
        }
2406
2407
        $res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']);
2408
    }
2409
2410
    /* CacheBlockTemplate: (Comment | Translate | If | Require |    OldI18NTag | Include | ClosedBlock |
2411
    OpenBlock | MalformedBlock | Injection | Text)+ */
2412
    protected $match_CacheBlockTemplate_typestack = array('CacheBlockTemplate','Template');
2413
    function match_CacheBlockTemplate ($stack = array()) {
2414
    	$matchrule = "CacheBlockTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'CacheRestrictedTemplate'));
2415
    	$count = 0;
2416
    	while (true) {
2417
    		$res_392 = $result;
2418
    		$pos_392 = $this->pos;
2419
    		$_391 = NULL;
2420
    		do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
2421
    			$_389 = NULL;
2422
    			do {
2423
    				$res_350 = $result;
2424
    				$pos_350 = $this->pos;
2425
    				$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
2426
    				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2427
    				if ($subres !== FALSE) {
2428
    					$this->store( $result, $subres );
2429
    					$_389 = TRUE; break;
2430
    				}
2431
    				$result = $res_350;
2432
    				$this->pos = $pos_350;
2433
    				$_387 = NULL;
2434
    				do {
2435
    					$res_352 = $result;
2436
    					$pos_352 = $this->pos;
2437
    					$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
2438
    					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2439
    					if ($subres !== FALSE) {
2440
    						$this->store( $result, $subres );
2441
    						$_387 = TRUE; break;
2442
    					}
2443
    					$result = $res_352;
2444
    					$this->pos = $pos_352;
2445
    					$_385 = NULL;
2446
    					do {
2447
    						$res_354 = $result;
2448
    						$pos_354 = $this->pos;
2449
    						$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
2450
    						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2451
    						if ($subres !== FALSE) {
2452
    							$this->store( $result, $subres );
2453
    							$_385 = TRUE; break;
2454
    						}
2455
    						$result = $res_354;
2456
    						$this->pos = $pos_354;
2457
    						$_383 = NULL;
2458
    						do {
2459
    							$res_356 = $result;
2460
    							$pos_356 = $this->pos;
2461
    							$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
2462
    							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2463
    							if ($subres !== FALSE) {
2464
    								$this->store( $result, $subres );
2465
    								$_383 = TRUE; break;
2466
    							}
2467
    							$result = $res_356;
2468
    							$this->pos = $pos_356;
2469
    							$_381 = NULL;
2470
    							do {
2471
    								$res_358 = $result;
2472
    								$pos_358 = $this->pos;
2473
    								$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
2474
    								$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2475
    								if ($subres !== FALSE) {
2476
    									$this->store( $result, $subres );
2477
    									$_381 = TRUE; break;
2478
    								}
2479
    								$result = $res_358;
2480
    								$this->pos = $pos_358;
2481
    								$_379 = NULL;
2482
    								do {
2483
    									$res_360 = $result;
2484
    									$pos_360 = $this->pos;
2485
    									$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
2486
    									$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2487
    									if ($subres !== FALSE) {
2488
    										$this->store( $result, $subres );
2489
    										$_379 = TRUE; break;
2490
    									}
2491
    									$result = $res_360;
2492
    									$this->pos = $pos_360;
2493
    									$_377 = NULL;
2494
    									do {
2495
    										$res_362 = $result;
2496
    										$pos_362 = $this->pos;
2497
    										$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
2498
    										$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2499
    										if ($subres !== FALSE) {
2500
    											$this->store( $result, $subres );
2501
    											$_377 = TRUE; break;
2502
    										}
2503
    										$result = $res_362;
2504
    										$this->pos = $pos_362;
2505
    										$_375 = NULL;
2506
    										do {
2507
    											$res_364 = $result;
2508
    											$pos_364 = $this->pos;
2509
    											$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
2510
    											$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2511
    											if ($subres !== FALSE) {
2512
    												$this->store( $result, $subres );
2513
    												$_375 = TRUE; break;
2514
    											}
2515
    											$result = $res_364;
2516
    											$this->pos = $pos_364;
2517
    											$_373 = NULL;
2518
    											do {
2519
    												$res_366 = $result;
2520
    												$pos_366 = $this->pos;
2521
    												$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
2522
    												$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2523
    												if ($subres !== FALSE) {
2524
    													$this->store( $result, $subres );
2525
    													$_373 = TRUE; break;
2526
    												}
2527
    												$result = $res_366;
2528
    												$this->pos = $pos_366;
2529
    												$_371 = NULL;
2530
    												do {
2531
    													$res_368 = $result;
2532
    													$pos_368 = $this->pos;
2533
    													$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
2534
    													$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2535
    													if ($subres !== FALSE) {
2536
    														$this->store( $result, $subres );
2537
    														$_371 = TRUE; break;
2538
    													}
2539
    													$result = $res_368;
2540
    													$this->pos = $pos_368;
2541
    													$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
2542
    													$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2543
    													if ($subres !== FALSE) {
2544
    														$this->store( $result, $subres );
2545
    														$_371 = TRUE; break;
2546
    													}
2547
    													$result = $res_368;
2548
    													$this->pos = $pos_368;
2549
    													$_371 = FALSE; break;
2550
    												}
2551
    												while(0);
2552
    												if( $_371 === TRUE ) { $_373 = TRUE; break; }
2553
    												$result = $res_366;
2554
    												$this->pos = $pos_366;
2555
    												$_373 = FALSE; break;
2556
    											}
2557
    											while(0);
2558
    											if( $_373 === TRUE ) { $_375 = TRUE; break; }
2559
    											$result = $res_364;
2560
    											$this->pos = $pos_364;
2561
    											$_375 = FALSE; break;
2562
    										}
2563
    										while(0);
2564
    										if( $_375 === TRUE ) { $_377 = TRUE; break; }
2565
    										$result = $res_362;
2566
    										$this->pos = $pos_362;
2567
    										$_377 = FALSE; break;
2568
    									}
2569
    									while(0);
2570
    									if( $_377 === TRUE ) { $_379 = TRUE; break; }
2571
    									$result = $res_360;
2572
    									$this->pos = $pos_360;
2573
    									$_379 = FALSE; break;
2574
    								}
2575
    								while(0);
2576
    								if( $_379 === TRUE ) { $_381 = TRUE; break; }
2577
    								$result = $res_358;
2578
    								$this->pos = $pos_358;
2579
    								$_381 = FALSE; break;
2580
    							}
2581
    							while(0);
2582
    							if( $_381 === TRUE ) { $_383 = TRUE; break; }
2583
    							$result = $res_356;
2584
    							$this->pos = $pos_356;
2585
    							$_383 = FALSE; break;
2586
    						}
2587
    						while(0);
2588
    						if( $_383 === TRUE ) { $_385 = TRUE; break; }
2589
    						$result = $res_354;
2590
    						$this->pos = $pos_354;
2591
    						$_385 = FALSE; break;
2592
    					}
2593
    					while(0);
2594
    					if( $_385 === TRUE ) { $_387 = TRUE; break; }
2595
    					$result = $res_352;
2596
    					$this->pos = $pos_352;
2597
    					$_387 = FALSE; break;
2598
    				}
2599
    				while(0);
2600
    				if( $_387 === TRUE ) { $_389 = TRUE; break; }
2601
    				$result = $res_350;
2602
    				$this->pos = $pos_350;
2603
    				$_389 = FALSE; break;
2604
    			}
2605
    			while(0);
2606
    			if( $_389 === FALSE) { $_391 = FALSE; break; }
2607
    			$_391 = TRUE; break;
2608
    		}
2609
    		while(0);
2610
    		if( $_391 === FALSE) {
2611
    			$result = $res_392;
2612
    			$this->pos = $pos_392;
2613
    			unset( $res_392 );
2614
    			unset( $pos_392 );
2615
    			break;
2616
    		}
2617
    		$count += 1;
2618
    	}
2619
    	if ($count > 0) { return $this->finalise($result); }
2620
    	else { return FALSE; }
2621
    }
2622
2623
2624
2625
2626
    /* UncachedBlock:
2627
    '<%' < "uncached" < CacheBlockArguments? ( < Conditional:("if"|"unless") > Condition:IfArgument )? > '%>'
2628
        Template:$TemplateMatcher?
2629
        '<%' < 'end_' ("uncached"|"cached"|"cacheblock") > '%>' */
2630
    protected $match_UncachedBlock_typestack = array('UncachedBlock');
2631
    function match_UncachedBlock ($stack = array()) {
2632
    	$matchrule = "UncachedBlock"; $result = $this->construct($matchrule, $matchrule, null);
2633
    	$_429 = NULL;
2634
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
2635
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
2636
    		else { $_429 = FALSE; break; }
2637
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2638
    		if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) { $result["text"] .= $subres; }
2639
    		else { $_429 = FALSE; break; }
2640
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2641
    		$res_397 = $result;
2642
    		$pos_397 = $this->pos;
2643
    		$matcher = 'match_'.'CacheBlockArguments'; $key = $matcher; $pos = $this->pos;
2644
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2645
    		if ($subres !== FALSE) {
2646
    			$this->store( $result, $subres );
2647
    		}
2648
    		else {
2649
    			$result = $res_397;
2650
    			$this->pos = $pos_397;
2651
    			unset( $res_397 );
2652
    			unset( $pos_397 );
2653
    		}
2654
    		$res_409 = $result;
2655
    		$pos_409 = $this->pos;
2656
    		$_408 = NULL;
2657
    		do {
2658
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2659
    			$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); 
2660
    			$_404 = NULL;
2661
    			do {
2662
    				$_402 = NULL;
2663
    				do {
2664
    					$res_399 = $result;
2665
    					$pos_399 = $this->pos;
2666
    					if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
2667
    						$result["text"] .= $subres;
2668
    						$_402 = TRUE; break;
2669
    					}
2670
    					$result = $res_399;
2671
    					$this->pos = $pos_399;
2672
    					if (( $subres = $this->literal( 'unless' ) ) !== FALSE) {
2673
    						$result["text"] .= $subres;
2674
    						$_402 = TRUE; break;
2675
    					}
2676
    					$result = $res_399;
2677
    					$this->pos = $pos_399;
2678
    					$_402 = FALSE; break;
2679
    				}
2680
    				while(0);
2681
    				if( $_402 === FALSE) { $_404 = FALSE; break; }
2682
    				$_404 = TRUE; break;
2683
    			}
2684
    			while(0);
2685
    			if( $_404 === TRUE ) {
2686
    				$subres = $result; $result = array_pop($stack);
2687
    				$this->store( $result, $subres, 'Conditional' );
2688
    			}
2689
    			if( $_404 === FALSE) {
2690
    				$result = array_pop($stack);
2691
    				$_408 = FALSE; break;
2692
    			}
2693
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2694
    			$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos;
2695
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2696
    			if ($subres !== FALSE) {
2697
    				$this->store( $result, $subres, "Condition" );
2698
    			}
2699
    			else { $_408 = FALSE; break; }
2700
    			$_408 = TRUE; break;
2701
    		}
2702
    		while(0);
2703
    		if( $_408 === FALSE) {
2704
    			$result = $res_409;
2705
    			$this->pos = $pos_409;
2706
    			unset( $res_409 );
2707
    			unset( $pos_409 );
2708
    		}
2709
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2710
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
2711
    		else { $_429 = FALSE; break; }
2712
    		$res_412 = $result;
2713
    		$pos_412 = $this->pos;
2714
    		$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
2715
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2716
    		if ($subres !== FALSE) {
2717
    			$this->store( $result, $subres, "Template" );
2718
    		}
2719
    		else {
2720
    			$result = $res_412;
2721
    			$this->pos = $pos_412;
2722
    			unset( $res_412 );
2723
    			unset( $pos_412 );
2724
    		}
2725
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
2726
    		else { $_429 = FALSE; break; }
2727
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2728
    		if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
2729
    		else { $_429 = FALSE; break; }
2730
    		$_425 = NULL;
2731
    		do {
2732
    			$_423 = NULL;
2733
    			do {
2734
    				$res_416 = $result;
2735
    				$pos_416 = $this->pos;
2736
    				if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
2737
    					$result["text"] .= $subres;
2738
    					$_423 = TRUE; break;
2739
    				}
2740
    				$result = $res_416;
2741
    				$this->pos = $pos_416;
2742
    				$_421 = NULL;
2743
    				do {
2744
    					$res_418 = $result;
2745
    					$pos_418 = $this->pos;
2746
    					if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
2747
    						$result["text"] .= $subres;
2748
    						$_421 = TRUE; break;
2749
    					}
2750
    					$result = $res_418;
2751
    					$this->pos = $pos_418;
2752
    					if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
2753
    						$result["text"] .= $subres;
2754
    						$_421 = TRUE; break;
2755
    					}
2756
    					$result = $res_418;
2757
    					$this->pos = $pos_418;
2758
    					$_421 = FALSE; break;
2759
    				}
2760
    				while(0);
2761
    				if( $_421 === TRUE ) { $_423 = TRUE; break; }
2762
    				$result = $res_416;
2763
    				$this->pos = $pos_416;
2764
    				$_423 = FALSE; break;
2765
    			}
2766
    			while(0);
2767
    			if( $_423 === FALSE) { $_425 = FALSE; break; }
2768
    			$_425 = TRUE; break;
2769
    		}
2770
    		while(0);
2771
    		if( $_425 === FALSE) { $_429 = FALSE; break; }
2772
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
2773
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
2774
    		else { $_429 = FALSE; break; }
2775
    		$_429 = TRUE; break;
2776
    	}
2777
    	while(0);
2778
    	if( $_429 === TRUE ) { return $this->finalise($result); }
2779
    	if( $_429 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_429 === FALSE is always true.
Loading history...
2780
    }
2781
2782
2783
2784
    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...
2785
    {
2786
        $res['php'] = $sub['php'];
2787
    }
2788
2789
    /* CacheRestrictedTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock |
2790
    OpenBlock | MalformedBlock | Injection | Text)+ */
2791
    protected $match_CacheRestrictedTemplate_typestack = array('CacheRestrictedTemplate','Template');
2792
    function match_CacheRestrictedTemplate ($stack = array()) {
2793
    	$matchrule = "CacheRestrictedTemplate"; $result = $this->construct($matchrule, $matchrule, null);
2794
    	$count = 0;
2795
    	while (true) {
2796
    		$res_481 = $result;
2797
    		$pos_481 = $this->pos;
2798
    		$_480 = NULL;
2799
    		do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
2800
    			$_478 = NULL;
2801
    			do {
2802
    				$res_431 = $result;
2803
    				$pos_431 = $this->pos;
2804
    				$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
2805
    				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2806
    				if ($subres !== FALSE) {
2807
    					$this->store( $result, $subres );
2808
    					$_478 = TRUE; break;
2809
    				}
2810
    				$result = $res_431;
2811
    				$this->pos = $pos_431;
2812
    				$_476 = NULL;
2813
    				do {
2814
    					$res_433 = $result;
2815
    					$pos_433 = $this->pos;
2816
    					$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
2817
    					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2818
    					if ($subres !== FALSE) {
2819
    						$this->store( $result, $subres );
2820
    						$_476 = TRUE; break;
2821
    					}
2822
    					$result = $res_433;
2823
    					$this->pos = $pos_433;
2824
    					$_474 = NULL;
2825
    					do {
2826
    						$res_435 = $result;
2827
    						$pos_435 = $this->pos;
2828
    						$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
2829
    						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2830
    						if ($subres !== FALSE) {
2831
    							$this->store( $result, $subres );
2832
    							$_474 = TRUE; break;
2833
    						}
2834
    						$result = $res_435;
2835
    						$this->pos = $pos_435;
2836
    						$_472 = NULL;
2837
    						do {
2838
    							$res_437 = $result;
2839
    							$pos_437 = $this->pos;
2840
    							$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
2841
    							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2842
    							if ($subres !== FALSE) {
2843
    								$this->store( $result, $subres );
2844
    								$_472 = TRUE; break;
2845
    							}
2846
    							$result = $res_437;
2847
    							$this->pos = $pos_437;
2848
    							$_470 = NULL;
2849
    							do {
2850
    								$res_439 = $result;
2851
    								$pos_439 = $this->pos;
2852
    								$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
2853
    								$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2854
    								if ($subres !== FALSE) {
2855
    									$this->store( $result, $subres );
2856
    									$_470 = TRUE; break;
2857
    								}
2858
    								$result = $res_439;
2859
    								$this->pos = $pos_439;
2860
    								$_468 = NULL;
2861
    								do {
2862
    									$res_441 = $result;
2863
    									$pos_441 = $this->pos;
2864
    									$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
2865
    									$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2866
    									if ($subres !== FALSE) {
2867
    										$this->store( $result, $subres );
2868
    										$_468 = TRUE; break;
2869
    									}
2870
    									$result = $res_441;
2871
    									$this->pos = $pos_441;
2872
    									$_466 = NULL;
2873
    									do {
2874
    										$res_443 = $result;
2875
    										$pos_443 = $this->pos;
2876
    										$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
2877
    										$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2878
    										if ($subres !== FALSE) {
2879
    											$this->store( $result, $subres );
2880
    											$_466 = TRUE; break;
2881
    										}
2882
    										$result = $res_443;
2883
    										$this->pos = $pos_443;
2884
    										$_464 = NULL;
2885
    										do {
2886
    											$res_445 = $result;
2887
    											$pos_445 = $this->pos;
2888
    											$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
2889
    											$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2890
    											if ($subres !== FALSE) {
2891
    												$this->store( $result, $subres );
2892
    												$_464 = TRUE; break;
2893
    											}
2894
    											$result = $res_445;
2895
    											$this->pos = $pos_445;
2896
    											$_462 = NULL;
2897
    											do {
2898
    												$res_447 = $result;
2899
    												$pos_447 = $this->pos;
2900
    												$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
2901
    												$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2902
    												if ($subres !== FALSE) {
2903
    													$this->store( $result, $subres );
2904
    													$_462 = TRUE; break;
2905
    												}
2906
    												$result = $res_447;
2907
    												$this->pos = $pos_447;
2908
    												$_460 = NULL;
2909
    												do {
2910
    													$res_449 = $result;
2911
    													$pos_449 = $this->pos;
2912
    													$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
2913
    													$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2914
    													if ($subres !== FALSE) {
2915
    														$this->store( $result, $subres );
2916
    														$_460 = TRUE; break;
2917
    													}
2918
    													$result = $res_449;
2919
    													$this->pos = $pos_449;
2920
    													$_458 = NULL;
2921
    													do {
2922
    														$res_451 = $result;
2923
    														$pos_451 = $this->pos;
2924
    														$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
2925
    														$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2926
    														if ($subres !== FALSE) {
2927
    															$this->store( $result, $subres );
2928
    															$_458 = TRUE; break;
2929
    														}
2930
    														$result = $res_451;
2931
    														$this->pos = $pos_451;
2932
    														$_456 = NULL;
2933
    														do {
2934
    															$res_453 = $result;
2935
    															$pos_453 = $this->pos;
2936
    															$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
2937
    															$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2938
    															if ($subres !== FALSE) {
2939
    																$this->store( $result, $subres );
2940
    																$_456 = TRUE; break;
2941
    															}
2942
    															$result = $res_453;
2943
    															$this->pos = $pos_453;
2944
    															$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
2945
    															$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
2946
    															if ($subres !== FALSE) {
2947
    																$this->store( $result, $subres );
2948
    																$_456 = TRUE; break;
2949
    															}
2950
    															$result = $res_453;
2951
    															$this->pos = $pos_453;
2952
    															$_456 = FALSE; break;
2953
    														}
2954
    														while(0);
2955
    														if( $_456 === TRUE ) { $_458 = TRUE; break; }
2956
    														$result = $res_451;
2957
    														$this->pos = $pos_451;
2958
    														$_458 = FALSE; break;
2959
    													}
2960
    													while(0);
2961
    													if( $_458 === TRUE ) { $_460 = TRUE; break; }
2962
    													$result = $res_449;
2963
    													$this->pos = $pos_449;
2964
    													$_460 = FALSE; break;
2965
    												}
2966
    												while(0);
2967
    												if( $_460 === TRUE ) { $_462 = TRUE; break; }
2968
    												$result = $res_447;
2969
    												$this->pos = $pos_447;
2970
    												$_462 = FALSE; break;
2971
    											}
2972
    											while(0);
2973
    											if( $_462 === TRUE ) { $_464 = TRUE; break; }
2974
    											$result = $res_445;
2975
    											$this->pos = $pos_445;
2976
    											$_464 = FALSE; break;
2977
    										}
2978
    										while(0);
2979
    										if( $_464 === TRUE ) { $_466 = TRUE; break; }
2980
    										$result = $res_443;
2981
    										$this->pos = $pos_443;
2982
    										$_466 = FALSE; break;
2983
    									}
2984
    									while(0);
2985
    									if( $_466 === TRUE ) { $_468 = TRUE; break; }
2986
    									$result = $res_441;
2987
    									$this->pos = $pos_441;
2988
    									$_468 = FALSE; break;
2989
    								}
2990
    								while(0);
2991
    								if( $_468 === TRUE ) { $_470 = TRUE; break; }
2992
    								$result = $res_439;
2993
    								$this->pos = $pos_439;
2994
    								$_470 = FALSE; break;
2995
    							}
2996
    							while(0);
2997
    							if( $_470 === TRUE ) { $_472 = TRUE; break; }
2998
    							$result = $res_437;
2999
    							$this->pos = $pos_437;
3000
    							$_472 = FALSE; break;
3001
    						}
3002
    						while(0);
3003
    						if( $_472 === TRUE ) { $_474 = TRUE; break; }
3004
    						$result = $res_435;
3005
    						$this->pos = $pos_435;
3006
    						$_474 = FALSE; break;
3007
    					}
3008
    					while(0);
3009
    					if( $_474 === TRUE ) { $_476 = TRUE; break; }
3010
    					$result = $res_433;
3011
    					$this->pos = $pos_433;
3012
    					$_476 = FALSE; break;
3013
    				}
3014
    				while(0);
3015
    				if( $_476 === TRUE ) { $_478 = TRUE; break; }
3016
    				$result = $res_431;
3017
    				$this->pos = $pos_431;
3018
    				$_478 = FALSE; break;
3019
    			}
3020
    			while(0);
3021
    			if( $_478 === FALSE) { $_480 = FALSE; break; }
3022
    			$_480 = TRUE; break;
3023
    		}
3024
    		while(0);
3025
    		if( $_480 === FALSE) {
3026
    			$result = $res_481;
3027
    			$this->pos = $pos_481;
3028
    			unset( $res_481 );
3029
    			unset( $pos_481 );
3030
    			break;
3031
    		}
3032
    		$count += 1;
3033
    	}
3034
    	if ($count > 0) { return $this->finalise($result); }
3035
    	else { return FALSE; }
3036
    }
3037
3038
3039
3040
    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...
3041
    {
3042
        throw new SSTemplateParseException('You cant have cache blocks nested within with, loop or control blocks ' .
3043
            'that are within cache blocks', $this);
3044
    }
3045
3046
    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...
3047
    {
3048
        throw new SSTemplateParseException('You cant have uncache blocks nested within with, loop or control blocks ' .
3049
            'that are within cache blocks', $this);
3050
    }
3051
3052
    /* CacheBlock:
3053
    '<%' < CacheTag:("cached"|"cacheblock") < (CacheBlockArguments)? ( < Conditional:("if"|"unless") >
3054
    Condition:IfArgument )? > '%>'
3055
        (CacheBlock | UncachedBlock | CacheBlockTemplate)*
3056
    '<%' < 'end_' ("cached"|"uncached"|"cacheblock") > '%>' */
3057
    protected $match_CacheBlock_typestack = array('CacheBlock');
3058
    function match_CacheBlock ($stack = array()) {
3059
    	$matchrule = "CacheBlock"; $result = $this->construct($matchrule, $matchrule, null);
3060
    	$_536 = NULL;
3061
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
3062
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
3063
    		else { $_536 = FALSE; break; }
3064
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3065
    		$stack[] = $result; $result = $this->construct( $matchrule, "CacheTag" ); 
3066
    		$_489 = NULL;
3067
    		do {
3068
    			$_487 = NULL;
3069
    			do {
3070
    				$res_484 = $result;
3071
    				$pos_484 = $this->pos;
3072
    				if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
3073
    					$result["text"] .= $subres;
3074
    					$_487 = TRUE; break;
3075
    				}
3076
    				$result = $res_484;
3077
    				$this->pos = $pos_484;
3078
    				if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
3079
    					$result["text"] .= $subres;
3080
    					$_487 = TRUE; break;
3081
    				}
3082
    				$result = $res_484;
3083
    				$this->pos = $pos_484;
3084
    				$_487 = FALSE; break;
3085
    			}
3086
    			while(0);
3087
    			if( $_487 === FALSE) { $_489 = FALSE; break; }
3088
    			$_489 = TRUE; break;
3089
    		}
3090
    		while(0);
3091
    		if( $_489 === TRUE ) {
3092
    			$subres = $result; $result = array_pop($stack);
3093
    			$this->store( $result, $subres, 'CacheTag' );
3094
    		}
3095
    		if( $_489 === FALSE) {
3096
    			$result = array_pop($stack);
3097
    			$_536 = FALSE; break;
3098
    		}
3099
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3100
    		$res_494 = $result;
3101
    		$pos_494 = $this->pos;
3102
    		$_493 = NULL;
3103
    		do {
3104
    			$matcher = 'match_'.'CacheBlockArguments'; $key = $matcher; $pos = $this->pos;
3105
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3106
    			if ($subres !== FALSE) {
3107
    				$this->store( $result, $subres );
3108
    			}
3109
    			else { $_493 = FALSE; break; }
3110
    			$_493 = TRUE; break;
3111
    		}
3112
    		while(0);
3113
    		if( $_493 === FALSE) {
3114
    			$result = $res_494;
3115
    			$this->pos = $pos_494;
3116
    			unset( $res_494 );
3117
    			unset( $pos_494 );
3118
    		}
3119
    		$res_506 = $result;
3120
    		$pos_506 = $this->pos;
3121
    		$_505 = NULL;
3122
    		do {
3123
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3124
    			$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" ); 
3125
    			$_501 = NULL;
3126
    			do {
3127
    				$_499 = NULL;
3128
    				do {
3129
    					$res_496 = $result;
3130
    					$pos_496 = $this->pos;
3131
    					if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
3132
    						$result["text"] .= $subres;
3133
    						$_499 = TRUE; break;
3134
    					}
3135
    					$result = $res_496;
3136
    					$this->pos = $pos_496;
3137
    					if (( $subres = $this->literal( 'unless' ) ) !== FALSE) {
3138
    						$result["text"] .= $subres;
3139
    						$_499 = TRUE; break;
3140
    					}
3141
    					$result = $res_496;
3142
    					$this->pos = $pos_496;
3143
    					$_499 = FALSE; break;
3144
    				}
3145
    				while(0);
3146
    				if( $_499 === FALSE) { $_501 = FALSE; break; }
3147
    				$_501 = TRUE; break;
3148
    			}
3149
    			while(0);
3150
    			if( $_501 === TRUE ) {
3151
    				$subres = $result; $result = array_pop($stack);
3152
    				$this->store( $result, $subres, 'Conditional' );
3153
    			}
3154
    			if( $_501 === FALSE) {
3155
    				$result = array_pop($stack);
3156
    				$_505 = FALSE; break;
3157
    			}
3158
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3159
    			$matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos;
3160
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3161
    			if ($subres !== FALSE) {
3162
    				$this->store( $result, $subres, "Condition" );
3163
    			}
3164
    			else { $_505 = FALSE; break; }
3165
    			$_505 = TRUE; break;
3166
    		}
3167
    		while(0);
3168
    		if( $_505 === FALSE) {
3169
    			$result = $res_506;
3170
    			$this->pos = $pos_506;
3171
    			unset( $res_506 );
3172
    			unset( $pos_506 );
3173
    		}
3174
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3175
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
3176
    		else { $_536 = FALSE; break; }
3177
    		while (true) {
3178
    			$res_519 = $result;
3179
    			$pos_519 = $this->pos;
3180
    			$_518 = NULL;
3181
    			do {
3182
    				$_516 = NULL;
3183
    				do {
3184
    					$res_509 = $result;
3185
    					$pos_509 = $this->pos;
3186
    					$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
3187
    					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3188
    					if ($subres !== FALSE) {
3189
    						$this->store( $result, $subres );
3190
    						$_516 = TRUE; break;
3191
    					}
3192
    					$result = $res_509;
3193
    					$this->pos = $pos_509;
3194
    					$_514 = NULL;
3195
    					do {
3196
    						$res_511 = $result;
3197
    						$pos_511 = $this->pos;
3198
    						$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
3199
    						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3200
    						if ($subres !== FALSE) {
3201
    							$this->store( $result, $subres );
3202
    							$_514 = TRUE; break;
3203
    						}
3204
    						$result = $res_511;
3205
    						$this->pos = $pos_511;
3206
    						$matcher = 'match_'.'CacheBlockTemplate'; $key = $matcher; $pos = $this->pos;
3207
    						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3208
    						if ($subres !== FALSE) {
3209
    							$this->store( $result, $subres );
3210
    							$_514 = TRUE; break;
3211
    						}
3212
    						$result = $res_511;
3213
    						$this->pos = $pos_511;
3214
    						$_514 = FALSE; break;
3215
    					}
3216
    					while(0);
3217
    					if( $_514 === TRUE ) { $_516 = TRUE; break; }
3218
    					$result = $res_509;
3219
    					$this->pos = $pos_509;
3220
    					$_516 = FALSE; break;
3221
    				}
3222
    				while(0);
3223
    				if( $_516 === FALSE) { $_518 = FALSE; break; }
3224
    				$_518 = TRUE; break;
3225
    			}
3226
    			while(0);
3227
    			if( $_518 === FALSE) {
3228
    				$result = $res_519;
3229
    				$this->pos = $pos_519;
3230
    				unset( $res_519 );
3231
    				unset( $pos_519 );
3232
    				break;
3233
    			}
3234
    		}
3235
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
3236
    		else { $_536 = FALSE; break; }
3237
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3238
    		if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
3239
    		else { $_536 = FALSE; break; }
3240
    		$_532 = NULL;
3241
    		do {
3242
    			$_530 = NULL;
3243
    			do {
3244
    				$res_523 = $result;
3245
    				$pos_523 = $this->pos;
3246
    				if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
3247
    					$result["text"] .= $subres;
3248
    					$_530 = TRUE; break;
3249
    				}
3250
    				$result = $res_523;
3251
    				$this->pos = $pos_523;
3252
    				$_528 = NULL;
3253
    				do {
3254
    					$res_525 = $result;
3255
    					$pos_525 = $this->pos;
3256
    					if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
3257
    						$result["text"] .= $subres;
3258
    						$_528 = TRUE; break;
3259
    					}
3260
    					$result = $res_525;
3261
    					$this->pos = $pos_525;
3262
    					if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
3263
    						$result["text"] .= $subres;
3264
    						$_528 = TRUE; break;
3265
    					}
3266
    					$result = $res_525;
3267
    					$this->pos = $pos_525;
3268
    					$_528 = FALSE; break;
3269
    				}
3270
    				while(0);
3271
    				if( $_528 === TRUE ) { $_530 = TRUE; break; }
3272
    				$result = $res_523;
3273
    				$this->pos = $pos_523;
3274
    				$_530 = FALSE; break;
3275
    			}
3276
    			while(0);
3277
    			if( $_530 === FALSE) { $_532 = FALSE; break; }
3278
    			$_532 = TRUE; break;
3279
    		}
3280
    		while(0);
3281
    		if( $_532 === FALSE) { $_536 = FALSE; break; }
3282
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3283
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
3284
    		else { $_536 = FALSE; break; }
3285
    		$_536 = TRUE; break;
3286
    	}
3287
    	while(0);
3288
    	if( $_536 === TRUE ) { return $this->finalise($result); }
3289
    	if( $_536 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_536 === FALSE is always true.
Loading history...
3290
    }
3291
3292
3293
3294
    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...
3295
    {
3296
        $res['subblocks'] = 0;
3297
    }
3298
3299
    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...
3300
    {
3301
        $res['key'] = !empty($sub['php']) ? $sub['php'] : '';
3302
    }
3303
3304
    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...
3305
    {
3306
        $res['condition'] = ($res['Conditional']['text'] == 'if' ? '(' : '!(') . $sub['php'] . ') && ';
3307
    }
3308
3309
    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...
3310
    {
3311
        $res['php'] .= $sub['php'];
3312
    }
3313
3314
    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...
3315
    {
3316
        $res['php'] .= $sub['php'];
3317
    }
3318
3319
    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...
3320
    {
3321
        // Get the block counter
3322
        $block = ++$res['subblocks'];
3323
        // Build the key for this block from the global key (evaluated in a closure within the template),
3324
        // the passed cache key, the block index, and the sha hash of the template.
3325
        $res['php'] .= '$keyExpression = function() use ($scope, $cache) {' . PHP_EOL;
3326
        $res['php'] .= '$val = \'\';' . PHP_EOL;
3327
        if ($globalKey = SSViewer::config()->get('global_key')) {
3328
            // Embed the code necessary to evaluate the globalKey directly into the template,
3329
            // so that SSTemplateParser only needs to be called during template regeneration.
3330
            // Warning: If the global key is changed, it's necessary to flush the template cache.
3331
            $parser = Injector::inst()->get(__CLASS__, false);
3332
            $result = $parser->compileString($globalKey, '', false, false);
3333
            if (!$result) {
3334
                throw new SSTemplateParseException('Unexpected problem parsing template', $parser);
3335
            }
3336
            $res['php'] .= $result . PHP_EOL;
3337
        }
3338
        $res['php'] .= 'return $val;' . PHP_EOL;
3339
        $res['php'] .= '};' . PHP_EOL;
3340
        $key = 'sha1($keyExpression())' // Global key
3341
            . '.\'_' . sha1($sub['php']) // sha of template
3342
            . (isset($res['key']) && $res['key'] ? "_'.sha1(".$res['key'].")" : "'") // Passed key
3343
            . ".'_$block'"; // block index
3344
        // Get any condition
3345
        $condition = isset($res['condition']) ? $res['condition'] : '';
3346
3347
        $res['php'] .= 'if ('.$condition.'($partial = $cache->get('.$key.'))) $val .= $partial;' . PHP_EOL;
3348
        $res['php'] .= 'else { $oldval = $val; $val = "";' . PHP_EOL;
3349
        $res['php'] .= $sub['php'] . PHP_EOL;
3350
        $res['php'] .= $condition . ' $cache->set('.$key.', $val); $val = $oldval . $val;' . PHP_EOL;
3351
        $res['php'] .= '}';
3352
    }
3353
3354
    /* OldTPart: "_t" N "(" N QuotedString (N "," N CallArguments)? N ")" N (";")? */
3355
    protected $match_OldTPart_typestack = array('OldTPart');
3356
    function match_OldTPart ($stack = array()) {
3357
    	$matchrule = "OldTPart"; $result = $this->construct($matchrule, $matchrule, null);
3358
    	$_555 = NULL;
3359
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
3360
    		if (( $subres = $this->literal( '_t' ) ) !== FALSE) { $result["text"] .= $subres; }
3361
    		else { $_555 = FALSE; break; }
3362
    		$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
3363
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3364
    		if ($subres !== FALSE) {
3365
    			$this->store( $result, $subres );
3366
    		}
3367
    		else { $_555 = FALSE; break; }
3368
    		if (substr($this->string,$this->pos,1) == '(') {
3369
    			$this->pos += 1;
3370
    			$result["text"] .= '(';
3371
    		}
3372
    		else { $_555 = FALSE; break; }
3373
    		$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
3374
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3375
    		if ($subres !== FALSE) {
3376
    			$this->store( $result, $subres );
3377
    		}
3378
    		else { $_555 = FALSE; break; }
3379
    		$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
3380
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3381
    		if ($subres !== FALSE) {
3382
    			$this->store( $result, $subres );
3383
    		}
3384
    		else { $_555 = FALSE; break; }
3385
    		$res_548 = $result;
3386
    		$pos_548 = $this->pos;
3387
    		$_547 = NULL;
3388
    		do {
3389
    			$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
3390
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3391
    			if ($subres !== FALSE) {
3392
    				$this->store( $result, $subres );
3393
    			}
3394
    			else { $_547 = FALSE; break; }
3395
    			if (substr($this->string,$this->pos,1) == ',') {
3396
    				$this->pos += 1;
3397
    				$result["text"] .= ',';
3398
    			}
3399
    			else { $_547 = FALSE; break; }
3400
    			$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
3401
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3402
    			if ($subres !== FALSE) {
3403
    				$this->store( $result, $subres );
3404
    			}
3405
    			else { $_547 = FALSE; break; }
3406
    			$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
3407
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3408
    			if ($subres !== FALSE) {
3409
    				$this->store( $result, $subres );
3410
    			}
3411
    			else { $_547 = FALSE; break; }
3412
    			$_547 = TRUE; break;
3413
    		}
3414
    		while(0);
3415
    		if( $_547 === FALSE) {
3416
    			$result = $res_548;
3417
    			$this->pos = $pos_548;
3418
    			unset( $res_548 );
3419
    			unset( $pos_548 );
3420
    		}
3421
    		$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
3422
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3423
    		if ($subres !== FALSE) {
3424
    			$this->store( $result, $subres );
3425
    		}
3426
    		else { $_555 = FALSE; break; }
3427
    		if (substr($this->string,$this->pos,1) == ')') {
3428
    			$this->pos += 1;
3429
    			$result["text"] .= ')';
3430
    		}
3431
    		else { $_555 = FALSE; break; }
3432
    		$matcher = 'match_'.'N'; $key = $matcher; $pos = $this->pos;
3433
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3434
    		if ($subres !== FALSE) {
3435
    			$this->store( $result, $subres );
3436
    		}
3437
    		else { $_555 = FALSE; break; }
3438
    		$res_554 = $result;
3439
    		$pos_554 = $this->pos;
3440
    		$_553 = NULL;
3441
    		do {
3442
    			if (substr($this->string,$this->pos,1) == ';') {
3443
    				$this->pos += 1;
3444
    				$result["text"] .= ';';
3445
    			}
3446
    			else { $_553 = FALSE; break; }
3447
    			$_553 = TRUE; break;
3448
    		}
3449
    		while(0);
3450
    		if( $_553 === FALSE) {
3451
    			$result = $res_554;
3452
    			$this->pos = $pos_554;
3453
    			unset( $res_554 );
3454
    			unset( $pos_554 );
3455
    		}
3456
    		$_555 = TRUE; break;
3457
    	}
3458
    	while(0);
3459
    	if( $_555 === TRUE ) { return $this->finalise($result); }
3460
    	if( $_555 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_555 === FALSE is always true.
Loading history...
3461
    }
3462
3463
3464
    /* N: / [\s\n]* / */
3465
    protected $match_N_typestack = array('N');
3466
    function match_N ($stack = array()) {
3467
    	$matchrule = "N"; $result = $this->construct($matchrule, $matchrule, null);
3468
    	if (( $subres = $this->rx( '/ [\s\n]* /' ) ) !== FALSE) {
3469
    		$result["text"] .= $subres;
3470
    		return $this->finalise($result);
3471
    	}
3472
    	else { return FALSE; }
3473
    }
3474
3475
3476
3477
    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...
3478
    {
3479
        $res['php'] = "_t(";
3480
    }
3481
3482
    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...
3483
    {
3484
        $entity = $sub['String']['text'];
3485
        if (strpos($entity, '.') === false) {
3486
            $res['php'] .= "\$scope->XML_val('I18NNamespace').'.$entity'";
3487
        } else {
3488
            $res['php'] .= "'$entity'";
3489
        }
3490
    }
3491
3492
    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...
3493
    {
3494
        $res['php'] .= ',' . $sub['php'];
3495
    }
3496
3497
    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...
3498
    {
3499
        $res['php'] .= ')';
3500
    }
3501
3502
    /* OldTTag: "<%" < OldTPart > "%>" */
3503
    protected $match_OldTTag_typestack = array('OldTTag');
3504
    function match_OldTTag ($stack = array()) {
3505
    	$matchrule = "OldTTag"; $result = $this->construct($matchrule, $matchrule, null);
3506
    	$_563 = NULL;
3507
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
3508
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
3509
    		else { $_563 = FALSE; break; }
3510
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3511
    		$matcher = 'match_'.'OldTPart'; $key = $matcher; $pos = $this->pos;
3512
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3513
    		if ($subres !== FALSE) {
3514
    			$this->store( $result, $subres );
3515
    		}
3516
    		else { $_563 = FALSE; break; }
3517
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3518
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
3519
    		else { $_563 = FALSE; break; }
3520
    		$_563 = TRUE; break;
3521
    	}
3522
    	while(0);
3523
    	if( $_563 === TRUE ) { return $this->finalise($result); }
3524
    	if( $_563 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_563 === FALSE is always true.
Loading history...
3525
    }
3526
3527
3528
3529
    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...
3530
    {
3531
        $res['php'] = $sub['php'];
3532
    }
3533
3534
    /* OldSprintfTag: "<%" < "sprintf" < "(" < OldTPart < "," < CallArguments > ")" > "%>" */
3535
    protected $match_OldSprintfTag_typestack = array('OldSprintfTag');
3536
    function match_OldSprintfTag ($stack = array()) {
3537
    	$matchrule = "OldSprintfTag"; $result = $this->construct($matchrule, $matchrule, null);
3538
    	$_580 = NULL;
3539
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
3540
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
3541
    		else { $_580 = FALSE; break; }
3542
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3543
    		if (( $subres = $this->literal( 'sprintf' ) ) !== FALSE) { $result["text"] .= $subres; }
3544
    		else { $_580 = FALSE; break; }
3545
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3546
    		if (substr($this->string,$this->pos,1) == '(') {
3547
    			$this->pos += 1;
3548
    			$result["text"] .= '(';
3549
    		}
3550
    		else { $_580 = FALSE; break; }
3551
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3552
    		$matcher = 'match_'.'OldTPart'; $key = $matcher; $pos = $this->pos;
3553
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3554
    		if ($subres !== FALSE) {
3555
    			$this->store( $result, $subres );
3556
    		}
3557
    		else { $_580 = FALSE; break; }
3558
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3559
    		if (substr($this->string,$this->pos,1) == ',') {
3560
    			$this->pos += 1;
3561
    			$result["text"] .= ',';
3562
    		}
3563
    		else { $_580 = FALSE; break; }
3564
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3565
    		$matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
3566
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3567
    		if ($subres !== FALSE) {
3568
    			$this->store( $result, $subres );
3569
    		}
3570
    		else { $_580 = FALSE; break; }
3571
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3572
    		if (substr($this->string,$this->pos,1) == ')') {
3573
    			$this->pos += 1;
3574
    			$result["text"] .= ')';
3575
    		}
3576
    		else { $_580 = FALSE; break; }
3577
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3578
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
3579
    		else { $_580 = FALSE; break; }
3580
    		$_580 = TRUE; break;
3581
    	}
3582
    	while(0);
3583
    	if( $_580 === TRUE ) { return $this->finalise($result); }
3584
    	if( $_580 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_580 === FALSE is always true.
Loading history...
3585
    }
3586
3587
3588
3589
    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...
3590
    {
3591
        $res['php'] = "sprintf(";
3592
    }
3593
3594
    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...
3595
    {
3596
        $res['php'] .= $sub['php'];
3597
    }
3598
3599
    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...
3600
    {
3601
        $res['php'] .= ',' . $sub['php'] . ')';
3602
    }
3603
3604
    /* OldI18NTag: OldSprintfTag | OldTTag */
3605
    protected $match_OldI18NTag_typestack = array('OldI18NTag');
3606
    function match_OldI18NTag ($stack = array()) {
3607
    	$matchrule = "OldI18NTag"; $result = $this->construct($matchrule, $matchrule, null);
3608
    	$_585 = NULL;
3609
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
3610
    		$res_582 = $result;
3611
    		$pos_582 = $this->pos;
3612
    		$matcher = 'match_'.'OldSprintfTag'; $key = $matcher; $pos = $this->pos;
3613
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3614
    		if ($subres !== FALSE) {
3615
    			$this->store( $result, $subres );
3616
    			$_585 = TRUE; break;
3617
    		}
3618
    		$result = $res_582;
3619
    		$this->pos = $pos_582;
3620
    		$matcher = 'match_'.'OldTTag'; $key = $matcher; $pos = $this->pos;
3621
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3622
    		if ($subres !== FALSE) {
3623
    			$this->store( $result, $subres );
3624
    			$_585 = TRUE; break;
3625
    		}
3626
    		$result = $res_582;
3627
    		$this->pos = $pos_582;
3628
    		$_585 = FALSE; break;
3629
    	}
3630
    	while(0);
3631
    	if( $_585 === TRUE ) { return $this->finalise($result); }
3632
    	if( $_585 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_585 === FALSE is always true.
Loading history...
3633
    }
3634
3635
3636
3637
    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...
3638
    {
3639
        $res['php'] = '$val .= ' . $sub['php'] . ';';
3640
    }
3641
3642
    /* NamedArgument: Name:Word "=" Value:Argument */
3643
    protected $match_NamedArgument_typestack = array('NamedArgument');
3644
    function match_NamedArgument ($stack = array()) {
3645
    	$matchrule = "NamedArgument"; $result = $this->construct($matchrule, $matchrule, null);
3646
    	$_590 = NULL;
3647
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
3648
    		$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
3649
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3650
    		if ($subres !== FALSE) {
3651
    			$this->store( $result, $subres, "Name" );
3652
    		}
3653
    		else { $_590 = FALSE; break; }
3654
    		if (substr($this->string,$this->pos,1) == '=') {
3655
    			$this->pos += 1;
3656
    			$result["text"] .= '=';
3657
    		}
3658
    		else { $_590 = FALSE; break; }
3659
    		$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
3660
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3661
    		if ($subres !== FALSE) {
3662
    			$this->store( $result, $subres, "Value" );
3663
    		}
3664
    		else { $_590 = FALSE; break; }
3665
    		$_590 = TRUE; break;
3666
    	}
3667
    	while(0);
3668
    	if( $_590 === TRUE ) { return $this->finalise($result); }
3669
    	if( $_590 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_590 === FALSE is always true.
Loading history...
3670
    }
3671
3672
3673
3674
    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...
3675
    {
3676
        $res['php'] = "'" . $sub['text'] . "' => ";
3677
    }
3678
3679
    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...
3680
    {
3681
        switch ($sub['ArgumentMode']) {
3682
            case 'string':
3683
                $res['php'] .= $sub['php'];
3684
                break;
3685
3686
            case 'default':
3687
                $res['php'] .= $sub['string_php'];
3688
                break;
3689
3690
            default:
3691
                $res['php'] .= str_replace('$$FINAL', 'obj', $sub['php']) . '->self()';
3692
                break;
3693
        }
3694
    }
3695
3696
    /* Include: "<%" < "include" < Template:NamespacedWord < (NamedArgument ( < "," < NamedArgument )*)? > "%>" */
3697
    protected $match_Include_typestack = array('Include');
3698
    function match_Include ($stack = array()) {
3699
    	$matchrule = "Include"; $result = $this->construct($matchrule, $matchrule, null);
3700
    	$_609 = NULL;
3701
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
3702
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
3703
    		else { $_609 = FALSE; break; }
3704
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3705
    		if (( $subres = $this->literal( 'include' ) ) !== FALSE) { $result["text"] .= $subres; }
3706
    		else { $_609 = FALSE; break; }
3707
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3708
    		$matcher = 'match_'.'NamespacedWord'; $key = $matcher; $pos = $this->pos;
3709
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3710
    		if ($subres !== FALSE) {
3711
    			$this->store( $result, $subres, "Template" );
3712
    		}
3713
    		else { $_609 = FALSE; break; }
3714
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3715
    		$res_606 = $result;
3716
    		$pos_606 = $this->pos;
3717
    		$_605 = NULL;
3718
    		do {
3719
    			$matcher = 'match_'.'NamedArgument'; $key = $matcher; $pos = $this->pos;
3720
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3721
    			if ($subres !== FALSE) {
3722
    				$this->store( $result, $subres );
3723
    			}
3724
    			else { $_605 = FALSE; break; }
3725
    			while (true) {
3726
    				$res_604 = $result;
3727
    				$pos_604 = $this->pos;
3728
    				$_603 = NULL;
3729
    				do {
3730
    					if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3731
    					if (substr($this->string,$this->pos,1) == ',') {
3732
    						$this->pos += 1;
3733
    						$result["text"] .= ',';
3734
    					}
3735
    					else { $_603 = FALSE; break; }
3736
    					if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3737
    					$matcher = 'match_'.'NamedArgument'; $key = $matcher; $pos = $this->pos;
3738
    					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3739
    					if ($subres !== FALSE) {
3740
    						$this->store( $result, $subres );
3741
    					}
3742
    					else { $_603 = FALSE; break; }
3743
    					$_603 = TRUE; break;
3744
    				}
3745
    				while(0);
3746
    				if( $_603 === FALSE) {
3747
    					$result = $res_604;
3748
    					$this->pos = $pos_604;
3749
    					unset( $res_604 );
3750
    					unset( $pos_604 );
3751
    					break;
3752
    				}
3753
    			}
3754
    			$_605 = TRUE; break;
3755
    		}
3756
    		while(0);
3757
    		if( $_605 === FALSE) {
3758
    			$result = $res_606;
3759
    			$this->pos = $pos_606;
3760
    			unset( $res_606 );
3761
    			unset( $pos_606 );
3762
    		}
3763
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3764
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
3765
    		else { $_609 = FALSE; break; }
3766
    		$_609 = TRUE; break;
3767
    	}
3768
    	while(0);
3769
    	if( $_609 === TRUE ) { return $this->finalise($result); }
3770
    	if( $_609 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_609 === FALSE is always true.
Loading history...
3771
    }
3772
3773
3774
3775
    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...
3776
    {
3777
        $res['arguments'] = array();
3778
    }
3779
3780
    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...
3781
    {
3782
        $res['template'] = "'" . $sub['text'] . "'";
3783
    }
3784
3785
    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...
3786
    {
3787
        $res['arguments'][] = $sub['php'];
3788
    }
3789
3790
    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...
3791
    {
3792
        $template = $res['template'];
3793
        $arguments = $res['arguments'];
3794
3795
        // Note: 'type' here is important to disable subTemplates in SSViewer::getSubtemplateFor()
3796
        $res['php'] = '$val .= \\SilverStripe\\View\\SSViewer::execute_template([["type" => "Includes", '.$template.'], '.$template.'], $scope->getItem(), array(' .
3797
            implode(',', $arguments)."), \$scope, true);\n";
3798
3799
        if ($this->includeDebuggingComments) { // Add include filename comments on dev sites
3800
            $res['php'] =
3801
                '$val .= \'<!-- include '.addslashes($template).' -->\';'. "\n".
3802
                $res['php'].
3803
                '$val .= \'<!-- end include '.addslashes($template).' -->\';'. "\n";
3804
        }
3805
    }
3806
3807
    /* BlockArguments: :Argument ( < "," < :Argument)* */
3808
    protected $match_BlockArguments_typestack = array('BlockArguments');
3809
    function match_BlockArguments ($stack = array()) {
3810
    	$matchrule = "BlockArguments"; $result = $this->construct($matchrule, $matchrule, null);
3811
    	$_618 = NULL;
3812
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
3813
    		$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
3814
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3815
    		if ($subres !== FALSE) {
3816
    			$this->store( $result, $subres, "Argument" );
3817
    		}
3818
    		else { $_618 = FALSE; break; }
3819
    		while (true) {
3820
    			$res_617 = $result;
3821
    			$pos_617 = $this->pos;
3822
    			$_616 = NULL;
3823
    			do {
3824
    				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3825
    				if (substr($this->string,$this->pos,1) == ',') {
3826
    					$this->pos += 1;
3827
    					$result["text"] .= ',';
3828
    				}
3829
    				else { $_616 = FALSE; break; }
3830
    				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3831
    				$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
3832
    				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
3833
    				if ($subres !== FALSE) {
3834
    					$this->store( $result, $subres, "Argument" );
3835
    				}
3836
    				else { $_616 = FALSE; break; }
3837
    				$_616 = TRUE; break;
3838
    			}
3839
    			while(0);
3840
    			if( $_616 === FALSE) {
3841
    				$result = $res_617;
3842
    				$this->pos = $pos_617;
3843
    				unset( $res_617 );
3844
    				unset( $pos_617 );
3845
    				break;
3846
    			}
3847
    		}
3848
    		$_618 = TRUE; break;
3849
    	}
3850
    	while(0);
3851
    	if( $_618 === TRUE ) { return $this->finalise($result); }
3852
    	if( $_618 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_618 === FALSE is always true.
Loading history...
3853
    }
3854
3855
3856
    /* NotBlockTag: "end_" | (("if" | "else_if" | "else" | "require" | "cached" | "uncached" | "cacheblock" | "include")]) */
3857
    protected $match_NotBlockTag_typestack = array('NotBlockTag');
3858
    function match_NotBlockTag ($stack = array()) {
3859
    	$matchrule = "NotBlockTag"; $result = $this->construct($matchrule, $matchrule, null);
3860
    	$_656 = NULL;
3861
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
3862
    		$res_620 = $result;
3863
    		$pos_620 = $this->pos;
3864
    		if (( $subres = $this->literal( 'end_' ) ) !== FALSE) {
3865
    			$result["text"] .= $subres;
3866
    			$_656 = TRUE; break;
3867
    		}
3868
    		$result = $res_620;
3869
    		$this->pos = $pos_620;
3870
    		$_654 = NULL;
3871
    		do {
3872
    			$_651 = NULL;
3873
    			do {
3874
    				$_649 = NULL;
3875
    				do {
3876
    					$res_622 = $result;
3877
    					$pos_622 = $this->pos;
3878
    					if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
3879
    						$result["text"] .= $subres;
3880
    						$_649 = TRUE; break;
3881
    					}
3882
    					$result = $res_622;
3883
    					$this->pos = $pos_622;
3884
    					$_647 = NULL;
3885
    					do {
3886
    						$res_624 = $result;
3887
    						$pos_624 = $this->pos;
3888
    						if (( $subres = $this->literal( 'else_if' ) ) !== FALSE) {
3889
    							$result["text"] .= $subres;
3890
    							$_647 = TRUE; break;
3891
    						}
3892
    						$result = $res_624;
3893
    						$this->pos = $pos_624;
3894
    						$_645 = NULL;
3895
    						do {
3896
    							$res_626 = $result;
3897
    							$pos_626 = $this->pos;
3898
    							if (( $subres = $this->literal( 'else' ) ) !== FALSE) {
3899
    								$result["text"] .= $subres;
3900
    								$_645 = TRUE; break;
3901
    							}
3902
    							$result = $res_626;
3903
    							$this->pos = $pos_626;
3904
    							$_643 = NULL;
3905
    							do {
3906
    								$res_628 = $result;
3907
    								$pos_628 = $this->pos;
3908
    								if (( $subres = $this->literal( 'require' ) ) !== FALSE) {
3909
    									$result["text"] .= $subres;
3910
    									$_643 = TRUE; break;
3911
    								}
3912
    								$result = $res_628;
3913
    								$this->pos = $pos_628;
3914
    								$_641 = NULL;
3915
    								do {
3916
    									$res_630 = $result;
3917
    									$pos_630 = $this->pos;
3918
    									if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
3919
    										$result["text"] .= $subres;
3920
    										$_641 = TRUE; break;
3921
    									}
3922
    									$result = $res_630;
3923
    									$this->pos = $pos_630;
3924
    									$_639 = NULL;
3925
    									do {
3926
    										$res_632 = $result;
3927
    										$pos_632 = $this->pos;
3928
    										if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
3929
    											$result["text"] .= $subres;
3930
    											$_639 = TRUE; break;
3931
    										}
3932
    										$result = $res_632;
3933
    										$this->pos = $pos_632;
3934
    										$_637 = NULL;
3935
    										do {
3936
    											$res_634 = $result;
3937
    											$pos_634 = $this->pos;
3938
    											if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
3939
    												$result["text"] .= $subres;
3940
    												$_637 = TRUE; break;
3941
    											}
3942
    											$result = $res_634;
3943
    											$this->pos = $pos_634;
3944
    											if (( $subres = $this->literal( 'include' ) ) !== FALSE) {
3945
    												$result["text"] .= $subres;
3946
    												$_637 = TRUE; break;
3947
    											}
3948
    											$result = $res_634;
3949
    											$this->pos = $pos_634;
3950
    											$_637 = FALSE; break;
3951
    										}
3952
    										while(0);
3953
    										if( $_637 === TRUE ) { $_639 = TRUE; break; }
3954
    										$result = $res_632;
3955
    										$this->pos = $pos_632;
3956
    										$_639 = FALSE; break;
3957
    									}
3958
    									while(0);
3959
    									if( $_639 === TRUE ) { $_641 = TRUE; break; }
3960
    									$result = $res_630;
3961
    									$this->pos = $pos_630;
3962
    									$_641 = FALSE; break;
3963
    								}
3964
    								while(0);
3965
    								if( $_641 === TRUE ) { $_643 = TRUE; break; }
3966
    								$result = $res_628;
3967
    								$this->pos = $pos_628;
3968
    								$_643 = FALSE; break;
3969
    							}
3970
    							while(0);
3971
    							if( $_643 === TRUE ) { $_645 = TRUE; break; }
3972
    							$result = $res_626;
3973
    							$this->pos = $pos_626;
3974
    							$_645 = FALSE; break;
3975
    						}
3976
    						while(0);
3977
    						if( $_645 === TRUE ) { $_647 = TRUE; break; }
3978
    						$result = $res_624;
3979
    						$this->pos = $pos_624;
3980
    						$_647 = FALSE; break;
3981
    					}
3982
    					while(0);
3983
    					if( $_647 === TRUE ) { $_649 = TRUE; break; }
3984
    					$result = $res_622;
3985
    					$this->pos = $pos_622;
3986
    					$_649 = FALSE; break;
3987
    				}
3988
    				while(0);
3989
    				if( $_649 === FALSE) { $_651 = FALSE; break; }
3990
    				$_651 = TRUE; break;
3991
    			}
3992
    			while(0);
3993
    			if( $_651 === FALSE) { $_654 = FALSE; break; }
3994
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
3995
    			else { $_654 = FALSE; break; }
3996
    			$_654 = TRUE; break;
3997
    		}
3998
    		while(0);
3999
    		if( $_654 === TRUE ) { $_656 = TRUE; break; }
4000
    		$result = $res_620;
4001
    		$this->pos = $pos_620;
4002
    		$_656 = FALSE; break;
4003
    	}
4004
    	while(0);
4005
    	if( $_656 === TRUE ) { return $this->finalise($result); }
4006
    	if( $_656 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_656 === FALSE is always true.
Loading history...
4007
    }
4008
4009
4010
    /* ClosedBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > Zap:'%>' Template:$TemplateMatcher?
4011
    '<%' < 'end_' '$BlockName' > '%>' */
4012
    protected $match_ClosedBlock_typestack = array('ClosedBlock');
4013
    function match_ClosedBlock ($stack = array()) {
4014
    	$matchrule = "ClosedBlock"; $result = $this->construct($matchrule, $matchrule, null);
4015
    	$_676 = NULL;
4016
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
4017
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
4018
    		else { $_676 = FALSE; break; }
4019
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4020
    		$res_660 = $result;
4021
    		$pos_660 = $this->pos;
4022
    		$matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos;
4023
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4024
    		if ($subres !== FALSE) {
4025
    			$this->store( $result, $subres );
4026
    			$result = $res_660;
4027
    			$this->pos = $pos_660;
4028
    			$_676 = FALSE; break;
4029
    		}
4030
    		else {
4031
    			$result = $res_660;
4032
    			$this->pos = $pos_660;
4033
    		}
4034
    		$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
4035
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4036
    		if ($subres !== FALSE) {
4037
    			$this->store( $result, $subres, "BlockName" );
4038
    		}
4039
    		else { $_676 = FALSE; break; }
4040
    		$res_666 = $result;
4041
    		$pos_666 = $this->pos;
4042
    		$_665 = NULL;
4043
    		do {
4044
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4045
    			else { $_665 = FALSE; break; }
4046
    			$matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos;
4047
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4048
    			if ($subres !== FALSE) {
4049
    				$this->store( $result, $subres, "BlockArguments" );
4050
    			}
4051
    			else { $_665 = FALSE; break; }
4052
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4053
    			else { $_665 = FALSE; break; }
4054
    			$_665 = TRUE; break;
4055
    		}
4056
    		while(0);
4057
    		if( $_665 === FALSE) {
4058
    			$result = $res_666;
4059
    			$this->pos = $pos_666;
4060
    			unset( $res_666 );
4061
    			unset( $pos_666 );
4062
    		}
4063
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4064
    		$stack[] = $result; $result = $this->construct( $matchrule, "Zap" ); 
4065
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) {
4066
    			$result["text"] .= $subres;
4067
    			$subres = $result; $result = array_pop($stack);
4068
    			$this->store( $result, $subres, 'Zap' );
4069
    		}
4070
    		else {
4071
    			$result = array_pop($stack);
4072
    			$_676 = FALSE; break;
4073
    		}
4074
    		$res_669 = $result;
4075
    		$pos_669 = $this->pos;
4076
    		$matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
4077
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4078
    		if ($subres !== FALSE) {
4079
    			$this->store( $result, $subres, "Template" );
4080
    		}
4081
    		else {
4082
    			$result = $res_669;
4083
    			$this->pos = $pos_669;
4084
    			unset( $res_669 );
4085
    			unset( $pos_669 );
4086
    		}
4087
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
4088
    		else { $_676 = FALSE; break; }
4089
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4090
    		if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
4091
    		else { $_676 = FALSE; break; }
4092
    		if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'BlockName').'' ) ) !== FALSE) { $result["text"] .= $subres; }
4093
    		else { $_676 = FALSE; break; }
4094
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4095
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
4096
    		else { $_676 = FALSE; break; }
4097
    		$_676 = TRUE; break;
4098
    	}
4099
    	while(0);
4100
    	if( $_676 === TRUE ) { return $this->finalise($result); }
4101
    	if( $_676 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_676 === FALSE is always true.
Loading history...
4102
    }
4103
4104
4105
4106
4107
    /**
4108
     * As mentioned in the parser comment, block handling is kept fairly generic for extensibility. The match rule
4109
     * builds up two important elements in the match result array:
4110
     *   'ArgumentCount' - how many arguments were passed in the opening tag
4111
     *   'Arguments' an array of the Argument match rule result arrays
4112
     *
4113
     * Once a block has successfully been matched against, it will then look for the actual handler, which should
4114
     * be on this class (either defined or extended on) as ClosedBlock_Handler_Name(&$res), where Name is the
4115
     * tag name, first letter captialized (i.e Control, Loop, With, etc).
4116
     *
4117
     * This function will be called with the match rule result array as it's first argument. It should return
4118
     * the php result of this block as it's return value, or throw an error if incorrect arguments were passed.
4119
     */
4120
4121
    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...
4122
    {
4123
        $res['ArgumentCount'] = 0;
4124
    }
4125
4126
    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...
4127
    {
4128
        if (isset($sub['Argument']['ArgumentMode'])) {
4129
            $res['Arguments'] = array($sub['Argument']);
4130
            $res['ArgumentCount'] = 1;
4131
        } else {
4132
            $res['Arguments'] = $sub['Argument'];
4133
            $res['ArgumentCount'] = count($res['Arguments']);
4134
        }
4135
    }
4136
4137
    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...
4138
    {
4139
        $blockname = $res['BlockName']['text'];
4140
4141
        $method = 'ClosedBlock_Handle_'.$blockname;
4142
        if (method_exists($this, $method)) {
4143
            $res['php'] = $this->$method($res);
4144
        } elseif (isset($this->closedBlocks[$blockname])) {
4145
            $res['php'] = call_user_func($this->closedBlocks[$blockname], $res);
4146
        } else {
4147
            throw new SSTemplateParseException('Unknown closed block "'.$blockname.'" encountered. Perhaps you are ' .
4148
            'not supposed to close this block, or have mis-spelled it?', $this);
4149
        }
4150
    }
4151
4152
    /**
4153
     * This is an example of a block handler function. This one handles the loop tag.
4154
     */
4155
    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...
4156
    {
4157
        if ($res['ArgumentCount'] > 1) {
4158
            throw new SSTemplateParseException('Either no or too many arguments in control block. Must be one ' .
4159
                'argument only.', $this);
4160
        }
4161
4162
        //loop without arguments loops on the current scope
4163
        if ($res['ArgumentCount'] == 0) {
4164
            $on = '$scope->obj(\'Up\', null)->obj(\'Foo\', null)';
4165
        } else {    //loop in the normal way
4166
            $arg = $res['Arguments'][0];
4167
            if ($arg['ArgumentMode'] == 'string') {
4168
                throw new SSTemplateParseException('Control block cant take string as argument.', $this);
4169
            }
4170
            $on = str_replace(
4171
                '$$FINAL',
4172
                'obj',
4173
                ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']
4174
            );
4175
        }
4176
4177
        return
4178
            $on . '; $scope->pushScope(); while (($key = $scope->next()) !== false) {' . PHP_EOL .
4179
                $res['Template']['php'] . PHP_EOL .
4180
            '}; $scope->popScope(); ';
4181
    }
4182
4183
    /**
4184
     * The closed block handler for with blocks
4185
     */
4186
    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...
4187
    {
4188
        if ($res['ArgumentCount'] != 1) {
4189
            throw new SSTemplateParseException('Either no or too many arguments in with block. Must be one ' .
4190
                'argument only.', $this);
4191
        }
4192
4193
        $arg = $res['Arguments'][0];
4194
        if ($arg['ArgumentMode'] == 'string') {
4195
            throw new SSTemplateParseException('Control block cant take string as argument.', $this);
4196
        }
4197
4198
        $on = str_replace('$$FINAL', 'obj', ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php']);
4199
        return
4200
            $on . '; $scope->pushScope();' . PHP_EOL .
4201
                $res['Template']['php'] . PHP_EOL .
4202
            '; $scope->popScope(); ';
4203
    }
4204
4205
    /* OpenBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > '%>' */
4206
    protected $match_OpenBlock_typestack = array('OpenBlock');
4207
    function match_OpenBlock ($stack = array()) {
4208
    	$matchrule = "OpenBlock"; $result = $this->construct($matchrule, $matchrule, null);
4209
    	$_689 = NULL;
4210
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
4211
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
4212
    		else { $_689 = FALSE; break; }
4213
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4214
    		$res_680 = $result;
4215
    		$pos_680 = $this->pos;
4216
    		$matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos;
4217
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4218
    		if ($subres !== FALSE) {
4219
    			$this->store( $result, $subres );
4220
    			$result = $res_680;
4221
    			$this->pos = $pos_680;
4222
    			$_689 = FALSE; break;
4223
    		}
4224
    		else {
4225
    			$result = $res_680;
4226
    			$this->pos = $pos_680;
4227
    		}
4228
    		$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
4229
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4230
    		if ($subres !== FALSE) {
4231
    			$this->store( $result, $subres, "BlockName" );
4232
    		}
4233
    		else { $_689 = FALSE; break; }
4234
    		$res_686 = $result;
4235
    		$pos_686 = $this->pos;
4236
    		$_685 = NULL;
4237
    		do {
4238
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4239
    			else { $_685 = FALSE; break; }
4240
    			$matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos;
4241
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4242
    			if ($subres !== FALSE) {
4243
    				$this->store( $result, $subres, "BlockArguments" );
4244
    			}
4245
    			else { $_685 = FALSE; break; }
4246
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4247
    			else { $_685 = FALSE; break; }
4248
    			$_685 = TRUE; break;
4249
    		}
4250
    		while(0);
4251
    		if( $_685 === FALSE) {
4252
    			$result = $res_686;
4253
    			$this->pos = $pos_686;
4254
    			unset( $res_686 );
4255
    			unset( $pos_686 );
4256
    		}
4257
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4258
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
4259
    		else { $_689 = FALSE; break; }
4260
    		$_689 = TRUE; break;
4261
    	}
4262
    	while(0);
4263
    	if( $_689 === TRUE ) { return $this->finalise($result); }
4264
    	if( $_689 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_689 === FALSE is always true.
Loading history...
4265
    }
4266
4267
4268
4269
    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...
4270
    {
4271
        $res['ArgumentCount'] = 0;
4272
    }
4273
4274
    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...
4275
    {
4276
        if (isset($sub['Argument']['ArgumentMode'])) {
4277
            $res['Arguments'] = array($sub['Argument']);
4278
            $res['ArgumentCount'] = 1;
4279
        } else {
4280
            $res['Arguments'] = $sub['Argument'];
4281
            $res['ArgumentCount'] = count($res['Arguments']);
4282
        }
4283
    }
4284
4285
    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...
4286
    {
4287
        $blockname = $res['BlockName']['text'];
4288
4289
        $method = 'OpenBlock_Handle_'.$blockname;
4290
        if (method_exists($this, $method)) {
4291
            $res['php'] = $this->$method($res);
4292
        } elseif (isset($this->openBlocks[$blockname])) {
4293
            $res['php'] = call_user_func($this->openBlocks[$blockname], $res);
4294
        } else {
4295
            throw new SSTemplateParseException('Unknown open block "'.$blockname.'" encountered. Perhaps you missed ' .
4296
            ' the closing tag or have mis-spelled it?', $this);
4297
        }
4298
    }
4299
4300
    /**
4301
     * This is an open block handler, for the <% debug %> utility tag
4302
     */
4303
    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...
4304
    {
4305
        if ($res['ArgumentCount'] == 0) {
4306
            return '$scope->debug();';
4307
        } elseif ($res['ArgumentCount'] == 1) {
4308
            $arg = $res['Arguments'][0];
4309
4310
            if ($arg['ArgumentMode'] == 'string') {
4311
                return 'Debug::show('.$arg['php'].');';
4312
            }
4313
4314
            $php = ($arg['ArgumentMode'] == 'default') ? $arg['lookup_php'] : $arg['php'];
4315
            return '$val .= Debug::show('.str_replace('FINALGET!', 'cachedCall', $php).');';
4316
        } else {
4317
            throw new SSTemplateParseException('Debug takes 0 or 1 argument only.', $this);
4318
        }
4319
    }
4320
4321
    /**
4322
     * This is an open block handler, for the <% base_tag %> tag
4323
     */
4324
    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...
4325
    {
4326
        if ($res['ArgumentCount'] != 0) {
4327
            throw new SSTemplateParseException('Base_tag takes no arguments', $this);
4328
        }
4329
        return '$val .= \\SilverStripe\\View\\SSViewer::get_base_tag($val);';
4330
    }
4331
4332
    /**
4333
     * This is an open block handler, for the <% current_page %> tag
4334
     */
4335
    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...
4336
    {
4337
        if ($res['ArgumentCount'] != 0) {
4338
            throw new SSTemplateParseException('Current_page takes no arguments', $this);
4339
        }
4340
        return '$val .= $_SERVER[SCRIPT_URL];';
4341
    }
4342
4343
    /* MismatchedEndBlock: '<%' < 'end_' :Word > '%>' */
4344
    protected $match_MismatchedEndBlock_typestack = array('MismatchedEndBlock');
4345
    function match_MismatchedEndBlock ($stack = array()) {
4346
    	$matchrule = "MismatchedEndBlock"; $result = $this->construct($matchrule, $matchrule, null);
4347
    	$_697 = NULL;
4348
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
4349
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
4350
    		else { $_697 = FALSE; break; }
4351
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4352
    		if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
4353
    		else { $_697 = FALSE; break; }
4354
    		$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
4355
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4356
    		if ($subres !== FALSE) {
4357
    			$this->store( $result, $subres, "Word" );
4358
    		}
4359
    		else { $_697 = FALSE; break; }
4360
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4361
    		if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
4362
    		else { $_697 = FALSE; break; }
4363
    		$_697 = TRUE; break;
4364
    	}
4365
    	while(0);
4366
    	if( $_697 === TRUE ) { return $this->finalise($result); }
4367
    	if( $_697 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_697 === FALSE is always true.
Loading history...
4368
    }
4369
4370
4371
4372
    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...
4373
    {
4374
        $blockname = $res['Word']['text'];
4375
        throw new SSTemplateParseException('Unexpected close tag end_' . $blockname .
4376
            ' encountered. Perhaps you have mis-nested blocks, or have mis-spelled a tag?', $this);
4377
    }
4378
4379
    /* MalformedOpenTag: '<%' < !NotBlockTag Tag:Word  !( ( [ :BlockArguments ] )? > '%>' ) */
4380
    protected $match_MalformedOpenTag_typestack = array('MalformedOpenTag');
4381
    function match_MalformedOpenTag ($stack = array()) {
4382
    	$matchrule = "MalformedOpenTag"; $result = $this->construct($matchrule, $matchrule, null);
4383
    	$_712 = NULL;
4384
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
4385
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
4386
    		else { $_712 = FALSE; break; }
4387
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4388
    		$res_701 = $result;
4389
    		$pos_701 = $this->pos;
4390
    		$matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos;
4391
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4392
    		if ($subres !== FALSE) {
4393
    			$this->store( $result, $subres );
4394
    			$result = $res_701;
4395
    			$this->pos = $pos_701;
4396
    			$_712 = FALSE; break;
4397
    		}
4398
    		else {
4399
    			$result = $res_701;
4400
    			$this->pos = $pos_701;
4401
    		}
4402
    		$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
4403
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4404
    		if ($subres !== FALSE) {
4405
    			$this->store( $result, $subres, "Tag" );
4406
    		}
4407
    		else { $_712 = FALSE; break; }
4408
    		$res_711 = $result;
4409
    		$pos_711 = $this->pos;
4410
    		$_710 = NULL;
4411
    		do {
4412
    			$res_707 = $result;
4413
    			$pos_707 = $this->pos;
4414
    			$_706 = NULL;
4415
    			do {
4416
    				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4417
    				else { $_706 = FALSE; break; }
4418
    				$matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos;
4419
    				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4420
    				if ($subres !== FALSE) {
4421
    					$this->store( $result, $subres, "BlockArguments" );
4422
    				}
4423
    				else { $_706 = FALSE; break; }
4424
    				if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4425
    				else { $_706 = FALSE; break; }
4426
    				$_706 = TRUE; break;
4427
    			}
4428
    			while(0);
4429
    			if( $_706 === FALSE) {
4430
    				$result = $res_707;
4431
    				$this->pos = $pos_707;
4432
    				unset( $res_707 );
4433
    				unset( $pos_707 );
4434
    			}
4435
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4436
    			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
4437
    			else { $_710 = FALSE; break; }
4438
    			$_710 = TRUE; break;
4439
    		}
4440
    		while(0);
4441
    		if( $_710 === TRUE ) {
4442
    			$result = $res_711;
4443
    			$this->pos = $pos_711;
4444
    			$_712 = FALSE; break;
4445
    		}
4446
    		if( $_710 === FALSE) {
4447
    			$result = $res_711;
4448
    			$this->pos = $pos_711;
4449
    		}
4450
    		$_712 = TRUE; break;
4451
    	}
4452
    	while(0);
4453
    	if( $_712 === TRUE ) { return $this->finalise($result); }
4454
    	if( $_712 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_712 === FALSE is always true.
Loading history...
4455
    }
4456
4457
4458
4459
    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...
4460
    {
4461
        $tag = $res['Tag']['text'];
4462
        throw new SSTemplateParseException("Malformed opening block tag $tag. Perhaps you have tried to use operators?", $this);
4463
    }
4464
4465
    /* MalformedCloseTag: '<%' < Tag:('end_' :Word ) !( > '%>' ) */
4466
    protected $match_MalformedCloseTag_typestack = array('MalformedCloseTag');
4467
    function match_MalformedCloseTag ($stack = array()) {
4468
    	$matchrule = "MalformedCloseTag"; $result = $this->construct($matchrule, $matchrule, null);
4469
    	$_724 = NULL;
4470
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
4471
    		if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
4472
    		else { $_724 = FALSE; break; }
4473
    		if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4474
    		$stack[] = $result; $result = $this->construct( $matchrule, "Tag" ); 
4475
    		$_718 = NULL;
4476
    		do {
4477
    			if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
4478
    			else { $_718 = FALSE; break; }
4479
    			$matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
4480
    			$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4481
    			if ($subres !== FALSE) {
4482
    				$this->store( $result, $subres, "Word" );
4483
    			}
4484
    			else { $_718 = FALSE; break; }
4485
    			$_718 = TRUE; break;
4486
    		}
4487
    		while(0);
4488
    		if( $_718 === TRUE ) {
4489
    			$subres = $result; $result = array_pop($stack);
4490
    			$this->store( $result, $subres, 'Tag' );
4491
    		}
4492
    		if( $_718 === FALSE) {
4493
    			$result = array_pop($stack);
4494
    			$_724 = FALSE; break;
4495
    		}
4496
    		$res_723 = $result;
4497
    		$pos_723 = $this->pos;
4498
    		$_722 = NULL;
4499
    		do {
4500
    			if (( $subres = $this->whitespace(  ) ) !== FALSE) { $result["text"] .= $subres; }
4501
    			if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
4502
    			else { $_722 = FALSE; break; }
4503
    			$_722 = TRUE; break;
4504
    		}
4505
    		while(0);
4506
    		if( $_722 === TRUE ) {
4507
    			$result = $res_723;
4508
    			$this->pos = $pos_723;
4509
    			$_724 = FALSE; break;
4510
    		}
4511
    		if( $_722 === FALSE) {
4512
    			$result = $res_723;
4513
    			$this->pos = $pos_723;
4514
    		}
4515
    		$_724 = TRUE; break;
4516
    	}
4517
    	while(0);
4518
    	if( $_724 === TRUE ) { return $this->finalise($result); }
4519
    	if( $_724 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_724 === FALSE is always true.
Loading history...
4520
    }
4521
4522
4523
4524
    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...
4525
    {
4526
        $tag = $res['Tag']['text'];
4527
        throw new SSTemplateParseException("Malformed closing block tag $tag. Perhaps you have tried to pass an " .
4528
            "argument to one?", $this);
4529
    }
4530
4531
    /* MalformedBlock: MalformedOpenTag | MalformedCloseTag */
4532
    protected $match_MalformedBlock_typestack = array('MalformedBlock');
4533
    function match_MalformedBlock ($stack = array()) {
4534
    	$matchrule = "MalformedBlock"; $result = $this->construct($matchrule, $matchrule, null);
4535
    	$_729 = NULL;
4536
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
4537
    		$res_726 = $result;
4538
    		$pos_726 = $this->pos;
4539
    		$matcher = 'match_'.'MalformedOpenTag'; $key = $matcher; $pos = $this->pos;
4540
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4541
    		if ($subres !== FALSE) {
4542
    			$this->store( $result, $subres );
4543
    			$_729 = TRUE; break;
4544
    		}
4545
    		$result = $res_726;
4546
    		$this->pos = $pos_726;
4547
    		$matcher = 'match_'.'MalformedCloseTag'; $key = $matcher; $pos = $this->pos;
4548
    		$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4549
    		if ($subres !== FALSE) {
4550
    			$this->store( $result, $subres );
4551
    			$_729 = TRUE; break;
4552
    		}
4553
    		$result = $res_726;
4554
    		$this->pos = $pos_726;
4555
    		$_729 = FALSE; break;
4556
    	}
4557
    	while(0);
4558
    	if( $_729 === TRUE ) { return $this->finalise($result); }
4559
    	if( $_729 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_729 === FALSE is always true.
Loading history...
4560
    }
4561
4562
4563
4564
4565
    /* Comment: "<%--" (!"--%>" /(?s)./)+ "--%>" */
4566
    protected $match_Comment_typestack = array('Comment');
4567
    function match_Comment ($stack = array()) {
4568
    	$matchrule = "Comment"; $result = $this->construct($matchrule, $matchrule, null);
4569
    	$_737 = NULL;
4570
    	do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
4571
    		if (( $subres = $this->literal( '<%--' ) ) !== FALSE) { $result["text"] .= $subres; }
4572
    		else { $_737 = FALSE; break; }
4573
    		$count = 0;
4574
    		while (true) {
4575
    			$res_735 = $result;
4576
    			$pos_735 = $this->pos;
4577
    			$_734 = NULL;
4578
    			do {
4579
    				$res_732 = $result;
4580
    				$pos_732 = $this->pos;
4581
    				if (( $subres = $this->literal( '--%>' ) ) !== FALSE) {
4582
    					$result["text"] .= $subres;
4583
    					$result = $res_732;
4584
    					$this->pos = $pos_732;
4585
    					$_734 = FALSE; break;
4586
    				}
4587
    				else {
4588
    					$result = $res_732;
4589
    					$this->pos = $pos_732;
4590
    				}
4591
    				if (( $subres = $this->rx( '/(?s)./' ) ) !== FALSE) { $result["text"] .= $subres; }
4592
    				else { $_734 = FALSE; break; }
4593
    				$_734 = TRUE; break;
4594
    			}
4595
    			while(0);
4596
    			if( $_734 === FALSE) {
4597
    				$result = $res_735;
4598
    				$this->pos = $pos_735;
4599
    				unset( $res_735 );
4600
    				unset( $pos_735 );
4601
    				break;
4602
    			}
4603
    			$count += 1;
4604
    		}
4605
    		if ($count > 0) {  }
4606
    		else { $_737 = FALSE; break; }
4607
    		if (( $subres = $this->literal( '--%>' ) ) !== FALSE) { $result["text"] .= $subres; }
4608
    		else { $_737 = FALSE; break; }
4609
    		$_737 = TRUE; break;
4610
    	}
4611
    	while(0);
4612
    	if( $_737 === TRUE ) { return $this->finalise($result); }
4613
    	if( $_737 === FALSE) { return FALSE; }
0 ignored issues
show
introduced by
The condition $_737 === FALSE is always true.
Loading history...
4614
    }
4615
4616
4617
4618
    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...
4619
    {
4620
        $res['php'] = '';
4621
    }
4622
4623
    /* TopTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock |
4624
    OpenBlock |  MalformedBlock | MismatchedEndBlock  | Injection | Text)+ */
4625
    protected $match_TopTemplate_typestack = array('TopTemplate','Template');
4626
    function match_TopTemplate ($stack = array()) {
4627
    	$matchrule = "TopTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'Template'));
4628
    	$count = 0;
4629
    	while (true) {
4630
    		$res_793 = $result;
4631
    		$pos_793 = $this->pos;
4632
    		$_792 = NULL;
4633
    		do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
4634
    			$_790 = NULL;
4635
    			do {
4636
    				$res_739 = $result;
4637
    				$pos_739 = $this->pos;
4638
    				$matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
4639
    				$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4640
    				if ($subres !== FALSE) {
4641
    					$this->store( $result, $subres );
4642
    					$_790 = TRUE; break;
4643
    				}
4644
    				$result = $res_739;
4645
    				$this->pos = $pos_739;
4646
    				$_788 = NULL;
4647
    				do {
4648
    					$res_741 = $result;
4649
    					$pos_741 = $this->pos;
4650
    					$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
4651
    					$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4652
    					if ($subres !== FALSE) {
4653
    						$this->store( $result, $subres );
4654
    						$_788 = TRUE; break;
4655
    					}
4656
    					$result = $res_741;
4657
    					$this->pos = $pos_741;
4658
    					$_786 = NULL;
4659
    					do {
4660
    						$res_743 = $result;
4661
    						$pos_743 = $this->pos;
4662
    						$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
4663
    						$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4664
    						if ($subres !== FALSE) {
4665
    							$this->store( $result, $subres );
4666
    							$_786 = TRUE; break;
4667
    						}
4668
    						$result = $res_743;
4669
    						$this->pos = $pos_743;
4670
    						$_784 = NULL;
4671
    						do {
4672
    							$res_745 = $result;
4673
    							$pos_745 = $this->pos;
4674
    							$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
4675
    							$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4676
    							if ($subres !== FALSE) {
4677
    								$this->store( $result, $subres );
4678
    								$_784 = TRUE; break;
4679
    							}
4680
    							$result = $res_745;
4681
    							$this->pos = $pos_745;
4682
    							$_782 = NULL;
4683
    							do {
4684
    								$res_747 = $result;
4685
    								$pos_747 = $this->pos;
4686
    								$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
4687
    								$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4688
    								if ($subres !== FALSE) {
4689
    									$this->store( $result, $subres );
4690
    									$_782 = TRUE; break;
4691
    								}
4692
    								$result = $res_747;
4693
    								$this->pos = $pos_747;
4694
    								$_780 = NULL;
4695
    								do {
4696
    									$res_749 = $result;
4697
    									$pos_749 = $this->pos;
4698
    									$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
4699
    									$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4700
    									if ($subres !== FALSE) {
4701
    										$this->store( $result, $subres );
4702
    										$_780 = TRUE; break;
4703
    									}
4704
    									$result = $res_749;
4705
    									$this->pos = $pos_749;
4706
    									$_778 = NULL;
4707
    									do {
4708
    										$res_751 = $result;
4709
    										$pos_751 = $this->pos;
4710
    										$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
4711
    										$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4712
    										if ($subres !== FALSE) {
4713
    											$this->store( $result, $subres );
4714
    											$_778 = TRUE; break;
4715
    										}
4716
    										$result = $res_751;
4717
    										$this->pos = $pos_751;
4718
    										$_776 = NULL;
4719
    										do {
4720
    											$res_753 = $result;
4721
    											$pos_753 = $this->pos;
4722
    											$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
4723
    											$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4724
    											if ($subres !== FALSE) {
4725
    												$this->store( $result, $subres );
4726
    												$_776 = TRUE; break;
4727
    											}
4728
    											$result = $res_753;
4729
    											$this->pos = $pos_753;
4730
    											$_774 = NULL;
4731
    											do {
4732
    												$res_755 = $result;
4733
    												$pos_755 = $this->pos;
4734
    												$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
4735
    												$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4736
    												if ($subres !== FALSE) {
4737
    													$this->store( $result, $subres );
4738
    													$_774 = TRUE; break;
4739
    												}
4740
    												$result = $res_755;
4741
    												$this->pos = $pos_755;
4742
    												$_772 = NULL;
4743
    												do {
4744
    													$res_757 = $result;
4745
    													$pos_757 = $this->pos;
4746
    													$matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
4747
    													$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4748
    													if ($subres !== FALSE) {
4749
    														$this->store( $result, $subres );
4750
    														$_772 = TRUE; break;
4751
    													}
4752
    													$result = $res_757;
4753
    													$this->pos = $pos_757;
4754
    													$_770 = NULL;
4755
    													do {
4756
    														$res_759 = $result;
4757
    														$pos_759 = $this->pos;
4758
    														$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
4759
    														$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4760
    														if ($subres !== FALSE) {
4761
    															$this->store( $result, $subres );
4762
    															$_770 = TRUE; break;
4763
    														}
4764
    														$result = $res_759;
4765
    														$this->pos = $pos_759;
4766
    														$_768 = NULL;
4767
    														do {
4768
    															$res_761 = $result;
4769
    															$pos_761 = $this->pos;
4770
    															$matcher = 'match_'.'MismatchedEndBlock'; $key = $matcher; $pos = $this->pos;
4771
    															$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4772
    															if ($subres !== FALSE) {
4773
    																$this->store( $result, $subres );
4774
    																$_768 = TRUE; break;
4775
    															}
4776
    															$result = $res_761;
4777
    															$this->pos = $pos_761;
4778
    															$_766 = NULL;
4779
    															do {
4780
    																$res_763 = $result;
4781
    																$pos_763 = $this->pos;
4782
    																$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $this->pos;
4783
    																$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4784
    																if ($subres !== FALSE) {
4785
    																	$this->store( $result, $subres );
4786
    																	$_766 = TRUE; break;
4787
    																}
4788
    																$result = $res_763;
4789
    																$this->pos = $pos_763;
4790
    																$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
4791
    																$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
4792
    																if ($subres !== FALSE) {
4793
    																	$this->store( $result, $subres );
4794
    																	$_766 = TRUE; break;
4795
    																}
4796
    																$result = $res_763;
4797
    																$this->pos = $pos_763;
4798
    																$_766 = FALSE; break;
4799
    															}
4800
    															while(0);
4801
    															if( $_766 === TRUE ) {
4802
    																$_768 = TRUE; break;
4803
    															}
4804
    															$result = $res_761;
4805
    															$this->pos = $pos_761;
4806
    															$_768 = FALSE; break;
4807
    														}
4808
    														while(0);
4809
    														if( $_768 === TRUE ) { $_770 = TRUE; break; }
4810
    														$result = $res_759;
4811
    														$this->pos = $pos_759;
4812
    														$_770 = FALSE; break;
4813
    													}
4814
    													while(0);
4815
    													if( $_770 === TRUE ) { $_772 = TRUE; break; }
4816
    													$result = $res_757;
4817
    													$this->pos = $pos_757;
4818
    													$_772 = FALSE; break;
4819
    												}
4820
    												while(0);
4821
    												if( $_772 === TRUE ) { $_774 = TRUE; break; }
4822
    												$result = $res_755;
4823
    												$this->pos = $pos_755;
4824
    												$_774 = FALSE; break;
4825
    											}
4826
    											while(0);
4827
    											if( $_774 === TRUE ) { $_776 = TRUE; break; }
4828
    											$result = $res_753;
4829
    											$this->pos = $pos_753;
4830
    											$_776 = FALSE; break;
4831
    										}
4832
    										while(0);
4833
    										if( $_776 === TRUE ) { $_778 = TRUE; break; }
4834
    										$result = $res_751;
4835
    										$this->pos = $pos_751;
4836
    										$_778 = FALSE; break;
4837
    									}
4838
    									while(0);
4839
    									if( $_778 === TRUE ) { $_780 = TRUE; break; }
4840
    									$result = $res_749;
4841
    									$this->pos = $pos_749;
4842
    									$_780 = FALSE; break;
4843
    								}
4844
    								while(0);
4845
    								if( $_780 === TRUE ) { $_782 = TRUE; break; }
4846
    								$result = $res_747;
4847
    								$this->pos = $pos_747;
4848
    								$_782 = FALSE; break;
4849
    							}
4850
    							while(0);
4851
    							if( $_782 === TRUE ) { $_784 = TRUE; break; }
4852
    							$result = $res_745;
4853
    							$this->pos = $pos_745;
4854
    							$_784 = FALSE; break;
4855
    						}
4856
    						while(0);
4857
    						if( $_784 === TRUE ) { $_786 = TRUE; break; }
4858
    						$result = $res_743;
4859
    						$this->pos = $pos_743;
4860
    						$_786 = FALSE; break;
4861
    					}
4862
    					while(0);
4863
    					if( $_786 === TRUE ) { $_788 = TRUE; break; }
4864
    					$result = $res_741;
4865
    					$this->pos = $pos_741;
4866
    					$_788 = FALSE; break;
4867
    				}
4868
    				while(0);
4869
    				if( $_788 === TRUE ) { $_790 = TRUE; break; }
4870
    				$result = $res_739;
4871
    				$this->pos = $pos_739;
4872
    				$_790 = FALSE; break;
4873
    			}
4874
    			while(0);
4875
    			if( $_790 === FALSE) { $_792 = FALSE; break; }
4876
    			$_792 = TRUE; break;
4877
    		}
4878
    		while(0);
4879
    		if( $_792 === FALSE) {
4880
    			$result = $res_793;
4881
    			$this->pos = $pos_793;
4882
    			unset( $res_793 );
4883
    			unset( $pos_793 );
4884
    			break;
4885
    		}
4886
    		$count += 1;
4887
    	}
4888
    	if ($count > 0) { return $this->finalise($result); }
4889
    	else { return FALSE; }
4890
    }
4891
4892
4893
4894
4895
    /**
4896
     * The TopTemplate also includes the opening stanza to start off the template
4897
     */
4898
    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...
4899
    {
4900
        $res['php'] = "<?php" . PHP_EOL;
4901
    }
4902
4903
    /* Text: (
4904
        / [^<${\\]+ / |
4905
        / (\\.) / |
4906
        '<' !'%' |
4907
        '$' !(/[A-Za-z_]/) |
4908
        '{' !'$' |
4909
        '{$' !(/[A-Za-z_]/)
4910
    )+ */
4911
    protected $match_Text_typestack = array('Text');
4912
    function match_Text ($stack = array()) {
4913
    	$matchrule = "Text"; $result = $this->construct($matchrule, $matchrule, null);
4914
    	$count = 0;
4915
    	while (true) {
4916
    		$res_832 = $result;
4917
    		$pos_832 = $this->pos;
4918
    		$_831 = NULL;
4919
    		do {
0 ignored issues
show
Unused Code introduced by
DoNode is not 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...
4920
    			$_829 = NULL;
4921
    			do {
4922
    				$res_794 = $result;
4923
    				$pos_794 = $this->pos;
4924
    				if (( $subres = $this->rx( '/ [^<${\\\\]+ /' ) ) !== FALSE) {
4925
    					$result["text"] .= $subres;
4926
    					$_829 = TRUE; break;
4927
    				}
4928
    				$result = $res_794;
4929
    				$this->pos = $pos_794;
4930
    				$_827 = NULL;
4931
    				do {
4932
    					$res_796 = $result;
4933
    					$pos_796 = $this->pos;
4934
    					if (( $subres = $this->rx( '/ (\\\\.) /' ) ) !== FALSE) {
4935
    						$result["text"] .= $subres;
4936
    						$_827 = TRUE; break;
4937
    					}
4938
    					$result = $res_796;
4939
    					$this->pos = $pos_796;
4940
    					$_825 = NULL;
4941
    					do {
4942
    						$res_798 = $result;
4943
    						$pos_798 = $this->pos;
4944
    						$_801 = NULL;
4945
    						do {
4946
    							if (substr($this->string,$this->pos,1) == '<') {
4947
    								$this->pos += 1;
4948
    								$result["text"] .= '<';
4949
    							}
4950
    							else { $_801 = FALSE; break; }
4951
    							$res_800 = $result;
4952
    							$pos_800 = $this->pos;
4953
    							if (substr($this->string,$this->pos,1) == '%') {
4954
    								$this->pos += 1;
4955
    								$result["text"] .= '%';
4956
    								$result = $res_800;
4957
    								$this->pos = $pos_800;
4958
    								$_801 = FALSE; break;
4959
    							}
4960
    							else {
4961
    								$result = $res_800;
4962
    								$this->pos = $pos_800;
4963
    							}
4964
    							$_801 = TRUE; break;
4965
    						}
4966
    						while(0);
4967
    						if( $_801 === TRUE ) { $_825 = TRUE; break; }
4968
    						$result = $res_798;
4969
    						$this->pos = $pos_798;
4970
    						$_823 = NULL;
4971
    						do {
4972
    							$res_803 = $result;
4973
    							$pos_803 = $this->pos;
4974
    							$_808 = NULL;
4975
    							do {
4976
    								if (substr($this->string,$this->pos,1) == '$') {
4977
    									$this->pos += 1;
4978
    									$result["text"] .= '$';
4979
    								}
4980
    								else { $_808 = FALSE; break; }
4981
    								$res_807 = $result;
4982
    								$pos_807 = $this->pos;
4983
    								$_806 = NULL;
4984
    								do {
4985
    									if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) {
4986
    										$result["text"] .= $subres;
4987
    									}
4988
    									else { $_806 = FALSE; break; }
4989
    									$_806 = TRUE; break;
4990
    								}
4991
    								while(0);
4992
    								if( $_806 === TRUE ) {
4993
    									$result = $res_807;
4994
    									$this->pos = $pos_807;
4995
    									$_808 = FALSE; break;
4996
    								}
4997
    								if( $_806 === FALSE) {
4998
    									$result = $res_807;
4999
    									$this->pos = $pos_807;
5000
    								}
5001
    								$_808 = TRUE; break;
5002
    							}
5003
    							while(0);
5004
    							if( $_808 === TRUE ) { $_823 = TRUE; break; }
5005
    							$result = $res_803;
5006
    							$this->pos = $pos_803;
5007
    							$_821 = NULL;
5008
    							do {
5009
    								$res_810 = $result;
5010
    								$pos_810 = $this->pos;
5011
    								$_813 = NULL;
5012
    								do {
5013
    									if (substr($this->string,$this->pos,1) == '{') {
5014
    										$this->pos += 1;
5015
    										$result["text"] .= '{';
5016
    									}
5017
    									else { $_813 = FALSE; break; }
5018
    									$res_812 = $result;
5019
    									$pos_812 = $this->pos;
5020
    									if (substr($this->string,$this->pos,1) == '$') {
5021
    										$this->pos += 1;
5022
    										$result["text"] .= '$';
5023
    										$result = $res_812;
5024
    										$this->pos = $pos_812;
5025
    										$_813 = FALSE; break;
5026
    									}
5027
    									else {
5028
    										$result = $res_812;
5029
    										$this->pos = $pos_812;
5030
    									}
5031
    									$_813 = TRUE; break;
5032
    								}
5033
    								while(0);
5034
    								if( $_813 === TRUE ) { $_821 = TRUE; break; }
5035
    								$result = $res_810;
5036
    								$this->pos = $pos_810;
5037
    								$_819 = NULL;
5038
    								do {
5039
    									if (( $subres = $this->literal( '{$' ) ) !== FALSE) {
5040
    										$result["text"] .= $subres;
5041
    									}
5042
    									else { $_819 = FALSE; break; }
5043
    									$res_818 = $result;
5044
    									$pos_818 = $this->pos;
5045
    									$_817 = NULL;
5046
    									do {
5047
    										if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) {
5048
    											$result["text"] .= $subres;
5049
    										}
5050
    										else { $_817 = FALSE; break; }
5051
    										$_817 = TRUE; break;
5052
    									}
5053
    									while(0);
5054
    									if( $_817 === TRUE ) {
5055
    										$result = $res_818;
5056
    										$this->pos = $pos_818;
5057
    										$_819 = FALSE; break;
5058
    									}
5059
    									if( $_817 === FALSE) {
5060
    										$result = $res_818;
5061
    										$this->pos = $pos_818;
5062
    									}
5063
    									$_819 = TRUE; break;
5064
    								}
5065
    								while(0);
5066
    								if( $_819 === TRUE ) { $_821 = TRUE; break; }
5067
    								$result = $res_810;
5068
    								$this->pos = $pos_810;
5069
    								$_821 = FALSE; break;
5070
    							}
5071
    							while(0);
5072
    							if( $_821 === TRUE ) { $_823 = TRUE; break; }
5073
    							$result = $res_803;
5074
    							$this->pos = $pos_803;
5075
    							$_823 = FALSE; break;
5076
    						}
5077
    						while(0);
5078
    						if( $_823 === TRUE ) { $_825 = TRUE; break; }
5079
    						$result = $res_798;
5080
    						$this->pos = $pos_798;
5081
    						$_825 = FALSE; break;
5082
    					}
5083
    					while(0);
5084
    					if( $_825 === TRUE ) { $_827 = TRUE; break; }
5085
    					$result = $res_796;
5086
    					$this->pos = $pos_796;
5087
    					$_827 = FALSE; break;
5088
    				}
5089
    				while(0);
5090
    				if( $_827 === TRUE ) { $_829 = TRUE; break; }
5091
    				$result = $res_794;
5092
    				$this->pos = $pos_794;
5093
    				$_829 = FALSE; break;
5094
    			}
5095
    			while(0);
5096
    			if( $_829 === FALSE) { $_831 = FALSE; break; }
5097
    			$_831 = TRUE; break;
5098
    		}
5099
    		while(0);
5100
    		if( $_831 === FALSE) {
5101
    			$result = $res_832;
5102
    			$this->pos = $pos_832;
5103
    			unset( $res_832 );
5104
    			unset( $pos_832 );
5105
    			break;
5106
    		}
5107
    		$count += 1;
5108
    	}
5109
    	if ($count > 0) { return $this->finalise($result); }
5110
    	else { return FALSE; }
5111
    }
5112
5113
5114
5115
5116
    /**
5117
     * We convert text
5118
     */
5119
    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...
5120
    {
5121
        $text = $res['text'];
5122
5123
        // Unescape any escaped characters in the text, then put back escapes for any single quotes and backslashes
5124
        $text = stripslashes($text);
5125
        $text = addcslashes($text, '\'\\');
5126
5127
        // TODO: This is pretty ugly & gets applied on all files not just html. I wonder if we can make this
5128
        // non-dynamically calculated
5129
        $code = <<<'EOC'
5130
(\SilverStripe\View\SSViewer::getRewriteHashLinksDefault()
5131
    ? \SilverStripe\Core\Convert::raw2att( preg_replace("/^(\\/)+/", "/", $_SERVER['REQUEST_URI'] ) )
5132
    : "")
5133
EOC;
5134
        // Because preg_replace replacement requires escaped slashes, addcslashes here
5135
        $text = preg_replace(
5136
            '/(<a[^>]+href *= *)"#/i',
5137
            '\\1"\' . ' . addcslashes($code, '\\')  . ' . \'#',
5138
            $text
5139
        );
5140
5141
        $res['php'] .= '$val .= \'' . $text . '\';' . PHP_EOL;
5142
    }
5143
5144
    /******************
5145
     * Here ends the parser itself. Below are utility methods to use the parser
5146
     */
5147
5148
    /**
5149
     * Compiles some passed template source code into the php code that will execute as per the template source.
5150
     *
5151
     * @throws SSTemplateParseException
5152
     * @param string $string The source of the template
5153
     * @param string $templateName The name of the template, normally the filename the template source was loaded from
5154
     * @param bool $includeDebuggingComments True is debugging comments should be included in the output
5155
     * @param bool $topTemplate True if this is a top template, false if it's just a template
5156
     * @return mixed|string The php that, when executed (via include or exec) will behave as per the template source
5157
     */
5158
    public function compileString($string, $templateName = "", $includeDebuggingComments = false, $topTemplate = true)
5159
    {
5160
        if (!trim($string)) {
5161
            $code = '';
5162
        } else {
5163
            parent::__construct($string);
5164
5165
            $this->includeDebuggingComments = $includeDebuggingComments;
5166
5167
            // Ignore UTF8 BOM at begining of string. TODO: Confirm this is needed, make sure SSViewer handles UTF
5168
            // (and other encodings) properly
5169
            if (substr($string, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) {
5170
                $this->pos = 3;
5171
            }
5172
5173
            // Match the source against the parser
5174
            if ($topTemplate) {
5175
                $result = $this->match_TopTemplate();
5176
            } else {
5177
                $result = $this->match_Template();
5178
            }
5179
            if (!$result) {
5180
                throw new SSTemplateParseException('Unexpected problem parsing template', $this);
5181
            }
5182
5183
            // Get the result
5184
            $code = $result['php'];
5185
        }
5186
5187
        // Include top level debugging comments if desired
5188
        if ($includeDebuggingComments && $templateName && stripos($code, "<?xml") === false) {
5189
            $code = $this->includeDebuggingComments($code, $templateName);
5190
        }
5191
5192
        return $code;
5193
    }
5194
5195
    /**
5196
     * @param string $code
5197
     * @return string $code
5198
     */
5199
    protected function includeDebuggingComments($code, $templateName)
5200
    {
5201
        // If this template contains a doctype, put it right after it,
5202
        // if not, put it after the <html> tag to avoid IE glitches
5203
        if (stripos($code, "<!doctype") !== false) {
5204
            $code = preg_replace('/(<!doctype[^>]*("[^"]")*[^>]*>)/im', "$1\r\n<!-- template $templateName -->", $code);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $1 seems to be never defined.
Loading history...
5205
            $code .= "\r\n" . '$val .= \'<!-- end template ' . $templateName . ' -->\';';
5206
        } elseif (stripos($code, "<html") !== false) {
5207
            $code = preg_replace_callback('/(.*)(<html[^>]*>)(.*)/i', function ($matches) use ($templateName) {
5208
                if (stripos($matches[3], '<!--') === false && stripos($matches[3], '-->') !== false) {
5209
                    // after this <html> tag there is a comment close but no comment has been opened
5210
                    // this most likely means that this <html> tag is inside a comment
5211
                    // we should not add a comment inside a comment (invalid html)
5212
                    // lets append it at the end of the comment
5213
                    // an example case for this is the html5boilerplate: <!--[if IE]><html class="ie"><![endif]-->
5214
                    return $matches[0];
5215
                } else {
5216
                    // all other cases, add the comment and return it
5217
                    return "{$matches[1]}{$matches[2]}<!-- template $templateName -->{$matches[3]}";
5218
                }
5219
            }, $code);
5220
            $code = preg_replace('/(<\/html[^>]*>)/i', "<!-- end template $templateName -->$1", $code);
5221
        } else {
5222
            $code = str_replace('<?php' . PHP_EOL, '<?php' . PHP_EOL . '$val .= \'<!-- template ' . $templateName .
5223
                ' -->\';' . "\r\n", $code);
5224
            $code .= "\r\n" . '$val .= \'<!-- end template ' . $templateName . ' -->\';';
5225
        }
5226
        return $code;
5227
    }
5228
5229
    /**
5230
     * Compiles some file that contains template source code, and returns the php code that will execute as per that
5231
     * source
5232
     *
5233
     * @static
5234
     * @param  $template - A file path that contains template source code
0 ignored issues
show
Documentation Bug introduced by
The doc comment - at position 0 could not be parsed: Unknown type name '-' at position 0 in -.
Loading history...
5235
     * @return mixed|string - The php that, when executed (via include or exec) will behave as per the template source
5236
     */
5237
    public function compileFile($template)
5238
    {
5239
        return $this->compileString(file_get_contents($template), $template);
5240
    }
5241
}
5242