LazyString
in package
implements
Stringable, JsonSerializable
A string whose value is computed lazily by a callback.
Tags
Table of Contents
Interfaces
- Stringable
- JsonSerializable
Properties
- $value : Closure|string
Methods
- __sleep() : array<string|int, mixed>
- __toString() : string
- fromCallable() : static
- fromStringable() : static
- isStringable() : bool
- Tells whether the provided value can be cast to string.
- jsonSerialize() : string
- resolve() : string
- Casts scalars and stringable objects to strings.
- __construct() : mixed
- getPrettyName() : string
Properties
$value
private
Closure|string
$value
Methods
__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__toString()
public
__toString() : string
Return values
stringfromCallable()
public
static fromCallable(callable|array<string|int, mixed> $callback, mixed ...$arguments) : static
Parameters
- $callback : callable|array<string|int, mixed>
-
A callable or a [Closure, method] lazy-callable
- $arguments : mixed
Return values
staticfromStringable()
public
static fromStringable(string|int|float|bool|Stringable $value) : static
Parameters
- $value : string|int|float|bool|Stringable
Return values
staticisStringable()
Tells whether the provided value can be cast to string.
public
final static isStringable(mixed $value) : bool
Parameters
- $value : mixed
Return values
booljsonSerialize()
public
jsonSerialize() : string
Return values
stringresolve()
Casts scalars and stringable objects to strings.
public
final static resolve(Stringable|string|int|float|bool $value) : string
Parameters
- $value : Stringable|string|int|float|bool
Tags
Return values
string__construct()
private
__construct() : mixed
getPrettyName()
private
static getPrettyName(callable $callback) : string
Parameters
- $callback : callable