Methods summary
public static
mixed
|
#
apply( callable $function, array|Traversable $args )
Applies function fn to the argument list args. This is useful for
creating a fixed-arity function from a variadic function. fn should be a
bound function if context is significant. (From Ramda).
Applies function fn to the argument list args. This is useful for
creating a fixed-arity function from a variadic function. fn should be a
bound function if context is significant. (From Ramda).
Parameters
Returns
mixed
|
public static
mixed
|
#
concat( string|array|Traversable $one, string|array|Traversable $other )
Concatenate the two provided values.
Concatenate the two provided values.
Parameters
Returns
mixed
Throws
|
public static
boolean
|
#
truthy( array $args )
Return the first non-false argument.
Return the first non-false argument.
Default: false
Parameters
Returns
boolean
|
public static
boolean
|
#
falsy( array $args )
Return the first non-true argument.
Return the first non-true argument.
Default: true
Parameters
Returns
boolean
|
public static
mixed|null
|
#
coalesce( array $args )
Return the first non-null argument.
Return the first non-null argument.
Parameters
Returns
mixed|null
|
public static
mixed|null
|
#
coalesceThunk( array $args )
Return the first non-null argument with support for thunks.
Return the first non-null argument with support for thunks.
Parameters
Returns
mixed|null
|
public static
|
|
public static
null|mixed
|
#
nonempty( mixed $args )
Return the first non-empty argument.
Return the first non-empty argument.
Parameters
Returns
null|mixed
|
public static
boolean
|
#
within( integer|float $min, integer|float $max, integer|float $value )
Check if a value is between two other values.
Check if a value is between two other values.
Parameters
Returns
boolean
Throws
|
public static
Chromabits\Nucleus\Strings\Rope
|
#
rope( string $string, string|null $encoding = null )
Create a new instance of a rope.
Create a new instance of a rope.
Parameters
Returns
|
public static
string
|
#
esc( string $string )
Escape the provided input for HTML.
Escape the provided input for HTML.
Parameters
Returns
string
|
public static
|
#
callSetters( object $object, array $input, array $allowed = null )
Set properties of an object by only calling setters of array keys that
are set in the input array. Useful for parsing API responses into
entities.
Set properties of an object by only calling setters of array keys that
are set in the input array. Useful for parsing API responses into
entities.
Parameters
|
public static
mixed
|
#
firstBias( boolean $biased, mixed|Closure $one, mixed|Closure $other )
Return the first value if the condition is true, otherwise, return the
second.
Return the first value if the condition is true, otherwise, return the
second.
Parameters
Returns
mixed
|
public static
mixed
|
#
thunk( Closure|mixed $value )
Return the default value of the given value.
Return the default value of the given value.
Parameters
Returns
mixed
|
public static
mixed
|
#
value( Closure|mixed $value )
Return the default value of the given value.
Return the default value of the given value.
Deprecated
See Std::thunk
Parameters
Returns
mixed
|
public static
string
|
#
jsonEncode( mixed $value, integer $options = 0, integer $depth = 512 )
Placeholder.
Deprecated
See Json::encode
Parameters
Returns
string
|
public static
mixed
|
|
public static
mixed
|
#
reduceRight( callable $function, mixed $initial, array|Traversable $list )
Alias of foldr.
Parameters
Returns
mixed
|
public static
mixed
|
#
foldl( callable $function, mixed $initial, array|Traversable $foldable )
Returns a single item by iterating through the list, successively calling
the iterator function and passing it an accumulator value and the current
value from the array, and then passing the result to the next call.
(From Ramda).
Returns a single item by iterating through the list, successively calling
the iterator function and passing it an accumulator value and the current
value from the array, and then passing the result to the next call.
(From Ramda).
Parameters
- $function
- $initial
- $foldable
Returns
mixed
Throws
|
public static
mixed
|
#
reduce( callable $function, mixed $initial, array|Traversable $traversable )
Alias of foldl.
Parameters
- $function
- $initial
- $traversable
Returns
mixed
|
public static
mixed
|
#
jsonDecode( mixed $value, integer $options = 0, integer $depth = 512 )
Placeholder.
Deprecated
See Json::decode
Parameters
Returns
mixed
|
public static
array
|
#
map( callable $function, array|Traversable $traversable )
Call a function on every item in a list and return the resulting list.
Call a function on every item in a list and return the resulting list.
Parameters
Returns
array
|
public static
array
|
#
filter( callable $function, array|Traversable $traversable )
Filter a list by calling a callback on each element.
Filter a list by calling a callback on each element.
If the callback returns true, then the element will be added to the
resulting array. Otherwise, it will be skipped.
Also, unlike array_filter, this function preserves indexes.
Parameters
Returns
array
|
public static
Closure|mixed
|
#
curry( callable $function, mixed $args )
Left-curry the provided function.
Left-curry the provided function.
Parameters
Returns
Closure|mixed
|
public static
Closure|mixed
|
#
curryArgs( callable $function, mixed[] $args )
Left-curry the provided function with the provided array of arguments.
Left-curry the provided function with the provided array of arguments.
Parameters
Returns
Closure|mixed
|
public static
mixed
|
#
call( callable $function, mixed $args )
Call the first argument with the remaining arguments.
Call the first argument with the remaining arguments.
Parameters
Returns
mixed
|
public static
|
#
poll( callable $function, integer $times )
Call a function N times.
This covers one of the most frequent case for using for-loops.
Parameters
|
public static
mixed|null
|
#
retry( callable $function, integer $attempts )
Attempt call the provided function a number of times until it no longer
throws an exception.
Attempt call the provided function a number of times until it no longer
throws an exception.
Parameters
Returns
mixed|null
Throws
|
public static
boolean
|
#
castToBool( mixed $mixed )
Attempt to cast a value into a bool.
Attempt to cast a value into a bool.
Parameters
Returns
boolean
Throws
|