Helper
in package
Table of Contents
Methods
- checkUnifiedValueTypes() : bool
- Check if all values in the given array are of the same type.
- containsAny() : bool
- Check if string contains any of the needles.
- convertToCSV() : string
- Convert the given data to CSV.
- escapeString() : string
- Escape the given value to comply with the PostgREST API.
- implodeWithBraces() : string
- Escape each element in the given array and implode them with the given open and close strings.
Methods
checkUnifiedValueTypes()
Check if all values in the given array are of the same type.
public
static checkUnifiedValueTypes(array<int|string, string|int|float> $array) : bool
Parameters
- $array : array<int|string, string|int|float>
-
The array to check.
Return values
bool —Returns true if all values are of the same type.
containsAny()
Check if string contains any of the needles.
public
static containsAny(string $haystack, array<string|int, string> $needles) : bool
Parameters
- $haystack : string
-
The string to check.
- $needles : array<string|int, string>
-
The needles to check for.
Return values
bool —Whether the haystack contains any of the needles.
convertToCSV()
Convert the given data to CSV.
public
static convertToCSV(array<string|int, array<string, mixed>> $data) : string
Parameters
- $data : array<string|int, array<string, mixed>>
-
The data to convert.
Return values
string —The CSV.
escapeString()
Escape the given value to comply with the PostgREST API.
public
static escapeString(string|int|float $value) : string
Parameters
- $value : string|int|float
-
The value to escape.
Return values
string —The escaped value.
implodeWithBraces()
Escape each element in the given array and implode them with the given open and close strings.
public
static implodeWithBraces(array<string|int, string>|array<string|int, int>|array<string|int, float> $value, string $open, string $close) : string
Parameters
- $value : array<string|int, string>|array<string|int, int>|array<string|int, float>
-
The array to implode.
- $open : string
-
The open string.
- $close : string
-
The close string.
Return values
string —The imploded string.