Utils
in package
Utility helpers.
Table of Contents
Constants
- TEMP_REGEX_AVOID_UNMASK = 'PLEACE_REPLACE_ME_AGAIN'
Methods
- array_flatten() : mixed
- Flatten an array.
- createRegexpPatternFromWildcardName() : mixed
- Create a pattern for `preg_match_all` usage.
- endsWith() : mixed
- Check if a string starts with a given needle.
- gzCompressForDatabase() : mixed
- Compress a string with `gzcompress` and encode it with `base64` so it can be saved in the database. Currently, we are not able to use compressed built-in MySQL functions, so we need to compress the data on our own at application level.
- gzUncompressForDatabase() : mixed
- Decompress a string with `gzuncompress`. See also `gzCompressForDatabase`.
- startsWith() : mixed
- Check if a string starts with a given needle.
Constants
TEMP_REGEX_AVOID_UNMASK
public
mixed
TEMP_REGEX_AVOID_UNMASK
= 'PLEACE_REPLACE_ME_AGAIN'
Methods
array_flatten()
Flatten an array.
public
static array_flatten(array<string|int, mixed> $array[, bool $recursive = false ]) : mixed
Parameters
- $array : array<string|int, mixed>
- $recursive : bool = false
createRegexpPatternFromWildcardName()
Create a pattern for `preg_match_all` usage.
public
static createRegexpPatternFromWildcardName(string $name) : mixed
Parameters
- $name : string
endsWith()
Check if a string starts with a given needle.
public
static endsWith(string $haystack, string $needle) : mixed
Parameters
- $haystack : string
-
The string to search in
- $needle : string
-
The starting string
Tags
gzCompressForDatabase()
Compress a string with `gzcompress` and encode it with `base64` so it can be saved in the database. Currently, we are not able to use compressed built-in MySQL functions, so we need to compress the data on our own at application level.
public
static gzCompressForDatabase(string $string[, mixed $default = null ]) : mixed
Attention: Use this method only for data that is only retrieved at application level as the data cannot be decompressed on database level.
Why gzcompress? See https://www.php.net/manual/de/function.gzdeflate.php#91310
gzcompress produces longer data because it embeds information about the encoding onto the string. If you are compressing data that will only ever be handled on one machine, then you don't need to worry about which of these functions you use. However, if you are passing data compressed with these functions to a different machine you should use gzcompress.
Parameters
- $string : string
- $default : mixed = null
gzUncompressForDatabase()
Decompress a string with `gzuncompress`. See also `gzCompressForDatabase`.
public
static gzUncompressForDatabase(string $string[, mixed $default = null ]) : mixed
Parameters
- $string : string
- $default : mixed = null
startsWith()
Check if a string starts with a given needle.
public
static startsWith(string $haystack, string $needle) : mixed
Parameters
- $haystack : string
-
The string to search in
- $needle : string
-
The starting string