PhpHelpers
final class PhpHelpers
| internal |
PHP helpers.
Methods
Optimizes code readability.
Exports value to PHP code representation.
Optimizes consecutive echo statements into single call.
Decodes number string to int or float value.
Decodes PHP string escape sequences (e.g. \n, \x1B, \u{1F600}).
Validates the generated PHP code using the given PHP binary as a linter.
Details
at line 24
static string
reformatCode(string $source)
Optimizes code readability.
at line 104
static string
dump(mixed $value, bool $multiline = false)
Exports value to PHP code representation.
at line 127
static string
optimizeEcho(string $source)
Optimizes consecutive echo statements into single call.
at line 169
static int|float|null
decodeNumber(string $str, int|null $base = null)
Decodes number string to int or float value.
at line 195
static string
decodeEscapeSequences(string $str, string|null $quote)
Decodes PHP string escape sequences (e.g. \n, \x1B, \u{1F600}).
Pass $quote to also unescape the given quote character.
at line 251
static void
checkCode(string $phpBinary, string $code, string $name)
Validates the generated PHP code using the given PHP binary as a linter.
Throws CompileException if the code contains syntax errors.