Flow PHP

ScalarFunctionChain implements ScalarFunction

AbstractYes

Interfaces

ScalarFunction

Methods

and()  : All
andNot()  : All
arrayFilter()  : self
Filters an array by removing all elements that matches passed value.
arrayGet()  : self
arrayGetCollection()  : self
arrayGetCollectionFirst()  : self
arrayKeep()  : self
Filters an array by keeping only elements that matches passed value.
arrayKeys()  : self
Returns all keys from an array, ignoring the values.
arrayMerge()  : self
arrayMergeCollection()  : self
arrayPathExists()  : self
arrayReverse()  : self
arraySort()  : self
arrayValues()  : self
Returns all values from an array, ignoring the keys.
ascii()  : self
between()  : self
capitalize()  : self
cast()  : self
coalesce()  : self
concat()  : self
concatWithSeparator()  : self
contains()  : self
dateFormat()  : self
dateTimeFormat()  : self
divide()  : self
domElementAttribute()  : self
domElementAttributesCount()  : self
domElementAttributeValue()  : self
domElementValue()  : self
endsWith()  : self
equals()  : self
exists()  : self
expand()  : self
Expands each value into entry, if there are more than one value, multiple rows will be created.
greaterThan()  : self
greaterThanEqual()  : self
hash()  : self
indexOf()  : self
Returns the index of given $needle in string.
isEven()  : self
isFalse()  : self
isIn()  : self
isNotNull()  : self
isNotNumeric()  : self
isNull()  : self
isNumeric()  : self
isOdd()  : self
isTrue()  : self
isType()  : self
isUtf8()  : IsUtf8
Check string is utf8 and returns true or false.
jsonDecode()  : self
jsonEncode()  : self
lessThan()  : self
lessThanEqual()  : self
literal()  : self
lower()  : self
minus()  : self
mod()  : self
modifyDateTime()  : self
multiply()  : self
notEquals()  : self
notSame()  : self
numberFormat()  : self
onEach()  : OnEach
Execute a scalar function on each element of an array/list/map/structure entry.
or()  : Any
orNot()  : Any
plus()  : self
power()  : self
regex()  : self
regexAll()  : RegexAll
regexMatch()  : self
regexMatchAll()  : self
regexReplace()  : self
round()  : self
same()  : self
sanitize()  : self
size()  : self
slug()  : self
split()  : self
sprintf()  : self
startsWith()  : self
stringAfter()  : self
Returns the contents found after the first occurrence of the given string.
stringAfterLast()  : self
Returns the contents found after the last occurrence of the given string.
stringBefore()  : self
Returns the contents found before the first occurrence of the given string.
stringBeforeLast()  : self
Returns the contents found before the last occurrence of the given string.
stringFold()  : self
Returns a string that you can use in case-insensitive comparisons.
stringStyle()  : self
Covert string to a style from enum list, passed in parameter.
stringTitle()  : self
Changes all graphemes/code points to "title case".
strPad()  : self
strPadBoth()  : self
strPadLeft()  : self
strPadRight()  : self
strReplace()  : self
toDate()  : self
toDateTime()  : self
trim()  : self
unpack()  : self
Unpacks each element of an array into a new entry, using the array key as the entry name.
upper()  : self
xpath()  : self

Methods

arrayFilter()

Filters an array by removing all elements that matches passed value.

public arrayFilter(mixed $value) : self

Applicable to all data structures that can be converted to an array:

  • json
  • list
  • map
  • structure.
Parameters
$value : mixed
Return values
self

arrayGetCollectionFirst()

public arrayGetCollectionFirst(string ...$keys) : self
Parameters
$keys : string
Return values
self

arrayKeep()

Filters an array by keeping only elements that matches passed value.

public arrayKeep(mixed $value) : self

Applicable to all data structures that can be converted to an array:

  • json
  • list
  • map
  • structure.
Parameters
$value : mixed
Return values
self

arrayKeys()

Returns all keys from an array, ignoring the values.

public arrayKeys() : self

Applicable to all data structures that can be converted to an array:

  • json
  • list
  • map
  • structure.
Return values
self

arrayValues()

Returns all values from an array, ignoring the keys.

public arrayValues() : self

Applicable to all data structures that can be converted to an array:

  • json
  • list
  • map
  • structure.
Return values
self

cast()

public cast(string|Type<string|int, mixed> $type[, Options|null $options = null ]) : self
Parameters
$type : string|Type<string|int, mixed>
$options : Options|null = null
Return values
self

dateFormat()

public dateFormat([string $format = 'Y-m-d' ]) : self
Parameters
$format : string = 'Y-m-d'
Return values
self

dateTimeFormat()

public dateTimeFormat([string $format = 'Y-m-d H:i:s' ]) : self
Parameters
$format : string = 'Y-m-d H:i:s'
Return values
self

domElementAttributesCount()

public domElementAttributesCount() : self
Return values
self

equals()

public equals(mixed $ref) : self
Parameters
$ref : mixed
Return values
self

expand()

Expands each value into entry, if there are more than one value, multiple rows will be created.

public expand([ArrayExpand $expand = ArrayExpand::VALUES ]) : self

Array keys are ignored, only values are used to create new rows.

Before: +--+-------------------+ |id| array| +--+-------------------+ | 1|{"a":1,"b":2,"c":3}| +--+-------------------+

After: +--+--------+ |id|expanded| +--+--------+ | 1| 1| | 1| 2| | 1| 3| +--+--------+

Parameters
$expand : ArrayExpand = ArrayExpand::VALUES
Return values
self

greaterThan()

public greaterThan(mixed $ref) : self
Parameters
$ref : mixed
Return values
self

greaterThanEqual()

public greaterThanEqual(mixed $ref) : self
Parameters
$ref : mixed
Return values
self

isType()

public isType(string|Type<string|int, mixed> ...$types) : self
Parameters
$types : string|Type<string|int, mixed>
Return values
self

lessThan()

public lessThan(mixed $ref) : self
Parameters
$ref : mixed
Return values
self

literal()

public literal(mixed $value) : self
Parameters
$value : mixed
Return values
self

notEquals()

public notEquals(mixed $value) : self
Parameters
$value : mixed
Return values
self

notSame()

public notSame(mixed $value) : self
Parameters
$value : mixed
Return values
self

onEach()

Execute a scalar function on each element of an array/list/map/structure entry.

public onEach(ScalarFunction $function[, ScalarFunction|bool $preserveKeys = true ]) : OnEach

In order to use this function, you need to provide a reference to the "element" that will be used in the function.

Example: $df->withEntry('array', ref('array')->onEach(ref('element')->cast(type_string())))

Parameters
$function : ScalarFunction
$preserveKeys : ScalarFunction|bool = true
Return values
OnEach

same()

public same(mixed $value) : self
Parameters
$value : mixed
Return values
self

stringFold()

Returns a string that you can use in case-insensitive comparisons.

public stringFold() : self
Return values
self

strPad()

public strPad(int $length[, string $pad_string = ' ' ][, int $type = STR_PAD_RIGHT ]) : self
Parameters
$length : int
$pad_string : string = ' '
$type : int = STR_PAD_RIGHT
Return values
self

strPadBoth()

public strPadBoth(int $length[, string $pad_string = ' ' ]) : self
Parameters
$length : int
$pad_string : string = ' '
Return values
self

strPadLeft()

public strPadLeft(int $length[, string $pad_string = ' ' ]) : self
Parameters
$length : int
$pad_string : string = ' '
Return values
self

strPadRight()

public strPadRight(int $length[, string $pad_string = ' ' ]) : self
Parameters
$length : int
$pad_string : string = ' '
Return values
self

toDate()

public toDate([ScalarFunction|string $format = DateTimeInterface::RFC3339 ][, ScalarFunction|DateTimeZone $timeZone = new DateTimeZone('UTC') ]) : self
Parameters
$format : ScalarFunction|string = DateTimeInterface::RFC3339
  • current format of the date that will be used to create DateTimeImmutable instance
$timeZone : ScalarFunction|DateTimeZone = new DateTimeZone('UTC')
Return values
self

toDateTime()

public toDateTime([ScalarFunction|string $format = 'Y-m-d H:i:s' ][, DateTimeZone|ScalarFunction $timeZone = new DateTimeZone('UTC') ]) : self
Parameters
$format : ScalarFunction|string = 'Y-m-d H:i:s'
  • current format of the date that will be used to create DateTimeImmutable instance
$timeZone : DateTimeZone|ScalarFunction = new DateTimeZone('UTC')
Return values
self

trim()

public trim([Type $type = TrimType::BOTH ][, string $characters = " " ]) : self
Parameters
$type : Type = TrimType::BOTH
$characters : string = " "
Return values
self

unpack()

Unpacks each element of an array into a new entry, using the array key as the entry name.

public unpack([ScalarFunction|array<string|int, mixed> $skipKeys = [] ][, ScalarFunction|string|null $entryPrefix = null ]) : self

Before: +--+-------------------+ |id| array| +--+-------------------+ | 1|{"a":1,"b":2,"c":3}| | 2|{"d":4,"e":5,"f":6}| +--+-------------------+

After: +--+-----+-----+-----+-----+-----+ |id|arr.b|arr.c|arr.d|arr.e|arr.f| +--+-----+-----+-----+-----+-----+ | 1| 2| 3| | | | | 2| | | 4| 5| 6| +--+-----+-----+-----+-----+-----+

Parameters
$skipKeys : ScalarFunction|array<string|int, mixed> = []
$entryPrefix : ScalarFunction|string|null = null
Return values
self

xpath()

public xpath(string $string) : self
Parameters
$string : string
Return values
self

        
On this page

Search results