Method | Description | |
---|---|---|
cycle ( array | Iterator | IteratorAggregate | |
Cycles through the source sequence. | |
emptyEnum ( ) : |
Returns an empty sequence. | |
from ( array | Iterator | IteratorAggregate | Traversable | |
Converts source into Enumerable sequence. | |
generate ( callable $funcValue, mixed $seedValue = null, callable | null $funcKey = null, mixed $seedKey = null ) : |
Generates a sequence by mimicking a for loop. | |
matches ( string $subject, string $pattern, integer $flags = PREG_SET_ORDER ) : |
Searches subject for all matches to the regular expression given in pattern and enumerates them in the order specified by flags. After the first match is found, the subsequent searches are continued on from end of the last match. | |
range ( integer $start, integer $count, integer $step = 1 ) : |
Generates a sequence of integral numbers, beginning with start and containing count elements. | |
rangeDown ( integer $start, integer $count, integer $step = 1 ) : |
Generates a reversed sequence of integral numbers, beginning with start and containing count elements. | |
rangeTo ( integer $start, integer $end, integer $step = 1 ) : |
Generates a sequence of integral numbers within a specified range from start to end. | |
repeat ( integer $element, integer $count = null ) : |
Generates an sequence that contains one repeated value. | |
returnEnum ( mixed $element ) : |
Returns a sequence that contains a single element with a specified value. | |
split ( string $subject, string $pattern, integer $flags ) : |
Split the given string by a regular expression. | |
toInfinity ( integer $start, integer $step = 1 ) : |
Generates a sequence of integral numbers to infinity. | |
toNegativeInfinity ( integer $start, integer $step = 1 ) : |
Generates a sequence of integral numbers to negative infinity. |
Method | Description | |
---|---|---|
fromTraversable ( $source ) |
Syntax: cycle (source)
Source keys are discarded.
public static cycle ( array | Iterator | IteratorAggregate | |
||
$source | array | Iterator | IteratorAggregate | |
Source sequence. |
return | Endless list of items repeating the source sequence. |
Syntax: emptyEnum ()
public static emptyEnum ( ) : |
||
return |
Syntax: from (source)
Result depends on the type of source:
public static from ( array | Iterator | IteratorAggregate | Traversable | |
||
$source | array | Iterator | IteratorAggregate | Traversable | |
Value to convert into Enumerable sequence. |
return |
Syntax: generate (funcValue {(v, k) ==> value} [, seedValue [, funcKey {(v, k) ==> key} [, seedKey]]])
If seedValue is null, the first value will be the result of calling funcValue on seedValue and seedKey. The same applies for seedKey.
public static generate ( callable $funcValue, mixed $seedValue = null, callable | null $funcKey = null, mixed $seedKey = null ) : |
||
$funcValue | callable | {(v, k) ==> value} State update function to run on value after every iteration of the generator loop. Default: value. |
$seedValue | mixed | Initial state of the generator loop for values. Default: null. |
$funcKey | callable | null | {(v, k) ==> key} State update function to run on key after every iteration of the generator loop. Default: increment. |
$seedKey | mixed | Initial state of the generator loop ofr keys. Default: 0. |
return |
Syntax: matches (subject, pattern [, flags])
public static matches ( string $subject, string $pattern, integer $flags = PREG_SET_ORDER ) : |
||
$subject | string | The input string. |
$pattern | string | The pattern to search for, as a string. |
$flags | integer | Can be a combination of the following flags: PREG_PATTERN_ORDER, PREG_SET_ORDER, PREG_OFFSET_CAPTURE. Default: PREG_SET_ORDER. |
return |
Syntax: range (start, count [, step])
Keys in the generated sequence are sequental: 0, 1, 2 etc.
Example: range(3, 4, 2) = 3, 5, 7, 9.
public static range ( integer $start, integer $count, integer $step = 1 ) : |
||
$start | integer | The value of the first integer in the sequence. |
$count | integer | The number of integers to generate. |
$step | integer | The difference between adjacent integers. Default: 1. |
return | A sequence that contains a range of integral numbers. |
Syntax: rangeDown (start, count [, step])
Keys in the generated sequence are sequental: 0, 1, 2 etc.
Example: rangeDown(9, 4, 2) = 9, 7, 5, 3.
public static rangeDown ( integer $start, integer $count, integer $step = 1 ) : |
||
$start | integer | The value of the first integer in the sequence. |
$count | integer | The number of integers to generate. |
$step | integer | The difference between adjacent integers. Default: 1. |
return | A sequence that contains a range of integral numbers. |
Syntax: rangeTo (start, end [, step])
Keys in the generated sequence are sequental: 0, 1, 2 etc.
Example: rangeTo(3, 9, 2) = 3, 5, 7, 9.
public static rangeTo ( integer $start, integer $end, integer $step = 1 ) : |
||
$start | integer | The value of the first integer in the sequence. |
$end | integer | The value of the last integer in the sequence (not included). |
$step | integer | The difference between adjacent integers. Default: 1. |
return | A sequence that contains a range of integral numbers. |
Syntax: repeat (element)
Generates an endless sequence that contains one repeated value.
Syntax: repeat (element, count)
Generates a sequence of specified length that contains one repeated value.
Keys in the generated sequence are sequental: 0, 1, 2 etc.
Syntax: returnEnum (element)
public static returnEnum ( mixed $element ) : |
||
$element | mixed | The single element in the resulting sequence. |
return | Observable sequence containing the single specified element. |
Syntax: split (subject, pattern [, flags])
public static split ( string $subject, string $pattern, integer $flags ) : |
||
$subject | string | The input string. |
$pattern | string | The pattern to search for, as a string. |
$flags | integer | flags can be any combination of the following flags: PREG_SPLIT_NO_EMPTY, PREG_SPLIT_DELIM_CAPTURE, PREG_SPLIT_OFFSET_CAPTURE. Default: 0. |
return |
Syntax: toInfinity ([start [, step]])
public static toInfinity ( integer $start, integer $step = 1 ) : |
||
$start | integer | The first integer in the sequence. Default: 0. |
$step | integer | The difference between adjacent integers. Default: 1. |
return |
Syntax: toNegativeInfinity ([start [, step]])
public static toNegativeInfinity ( integer $start, integer $step = 1 ) : |
||
$start | integer | The first integer in the sequence. Default: 0. |
$step | integer | The difference between adjacent integers. Default: 1. |
return |