[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/ -> Optimizer.php (summary)

(no description)

Copyright: Copyright (c) 2010-2022 The s9e authors
License: http://www.opensource.org/licenses/mit-license.php The MIT License
File Size: 433 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Optimizer:: (15 methods):
  __construct()
  optimize()
  isBetweenHtmlspecialcharCalls()
  isHtmlspecialcharSafeVar()
  isOutputAssignment()
  isPrecededByOutputVar()
  mergeConcatenatedHtmlSpecialChars()
  mergeConcatenatedStrings()
  optimizeOutConcatEqual()
  optimizeConcatenations()
  optimizeHtmlspecialchars()
  removeHtmlspecialcharsSafeVar()
  replaceHtmlspecialcharsLiteral()
  skipPast()
  skipTo()


Class: Optimizer  - X-Ref

This class optimizes the code produced by the PHP renderer. It is not meant to be used on general
purpose code

__construct()   X-Ref
Constructor


optimize($php)   X-Ref
Optimize the code generated by the PHP renderer generator

param: string $php Original code
return: string      Optimized code

isBetweenHtmlspecialcharCalls()   X-Ref
Test whether current token is between two htmlspecialchars() calls

return: bool

isHtmlspecialcharSafeVar()   X-Ref
Test whether current token is at the beginning of an htmlspecialchars()-safe var

Tests whether current var is either $node->localName or $node->nodeName

return: bool

isOutputAssignment()   X-Ref
Test whether the cursor is at the beginning of an output assignment

return: bool

isPrecededByOutputVar()   X-Ref
Test whether the cursor is immediately after the output variable

return: bool

mergeConcatenatedHtmlSpecialChars()   X-Ref
Merge concatenated htmlspecialchars() calls together

Must be called when the cursor is at the concatenation operator

return: bool Whether calls were merged

mergeConcatenatedStrings()   X-Ref
Merge concatenated strings together

Must be called when the cursor is at the concatenation operator

return: bool Whether strings were merged

optimizeOutConcatEqual()   X-Ref
Optimize T_CONCAT_EQUAL assignments in an array of PHP tokens

Will only optimize $this->out.= assignments

return: void

optimizeConcatenations()   X-Ref
Optimize concatenations in an array of PHP tokens

- Will precompute the result of the concatenation of constant strings
- Will replace the concatenation of two compatible htmlspecialchars() calls with one call to
htmlspecialchars() on the concatenation of their first arguments

return: void

optimizeHtmlspecialchars()   X-Ref
Optimize htmlspecialchars() calls

- The result of htmlspecialchars() on literals is precomputed
- By default, the generator escapes all values, including variables that cannot contain
special characters such as $node->localName. This pass removes those calls

return: void

removeHtmlspecialcharsSafeVar()   X-Ref
Remove htmlspecialchars() calls on variables that are known to be safe

Must be called when the cursor is at the first argument of the call

return: bool Whether the call was removed

replaceHtmlspecialcharsLiteral()   X-Ref
Precompute the result of a htmlspecialchars() call on a string literal

Must be called when the cursor is at the first argument of the call

return: bool Whether the call was replaced

skipPast($token)   X-Ref
Move the cursor past given token

param: array|string $token Target token
return: bool                Whether a matching token was found and the cursor is within bounds

skipTo($token)   X-Ref
Move the cursor until it reaches given token

param: array|string $token Target token
return: bool                Whether a matching token was found



Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1