Documentation

LazyString
in package
implements Stringable, JsonSerializable

A string whose value is computed lazily by a callback.

Tags
author

Nicolas Grekas p@tchwork.com

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

Methods

__sleep()

public __sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>

__toString()

public __toString() : string
Return values
string

fromCallable()

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
static

fromStringable()

public static fromStringable(string|int|float|bool|Stringable $value) : static
Parameters
$value : string|int|float|bool|Stringable
Return values
static

isStringable()

Tells whether the provided value can be cast to string.

public final static isStringable(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

jsonSerialize()

public jsonSerialize() : string
Return values
string

resolve()

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
throws
TypeError

When the provided value is not stringable

Return values
string

getPrettyName()

private static getPrettyName(callable $callback) : string
Parameters
$callback : callable
Return values
string

        
On this page

Search results