functions.php

Functions

collect()

collect(mixed  $args) : \LazyCollection\Stream

Collect the spread arguments into a stream

Parameters

mixed $args

Returns

\LazyCollection\Stream

stream()

stream(\LazyCollection\iterable  $it) : \LazyCollection\Stream

Wrap the given iterable into a stream

Parameters

\LazyCollection\iterable $it
  • The iterable to wrap

Returns

\LazyCollection\Stream

infiniteRange()

infiniteRange(  $start,   $step) : \LazyCollection\Stream

Create an infinite range

Parameters

$start
  • The first element
$step
  • The amount to increment by

Returns

\LazyCollection\Stream

range()

range(integer  $begin, integer|null  $end = null, integer  $step = 1) : \LazyCollection\Stream

Create a range of integers

Parameters

integer $begin
  • The first element
integer|null $end
  • The maximum last element
integer $step
  • The amount to increment by

Returns

\LazyCollection\Stream

splitBy()

splitBy(string  $str, string  $separator = "", boolean  $removeEmptyStrings = true) : \LazyCollection\Stream

Make a stream by splitting a string in parts

Parameters

string $str
  • The string to split
string $separator
  • The separator to split by
boolean $removeEmptyStrings
  • Whether or not it should remove empty strings from the resulting stream

Returns

\LazyCollection\Stream

splitByRegex()

splitByRegex(string  $str, string  $re, boolean  $removeEmptyStrings = true) : \LazyCollection\Stream

Make a stream by splitting a string in parts using a regular expression

Parameters

string $str
  • The string to split
string $re
boolean $removeEmptyStrings
  • Whether or not it should remove empty strings from the resulting stream

Returns

\LazyCollection\Stream