Skip to content

Latest commit

 

History

History
249 lines (89 loc) · 2.24 KB

LazyString.md

File metadata and controls

249 lines (89 loc) · 2.24 KB

LazyString

A string whose value is computed lazily by a callback.

Properties

value

private \Closure|string $value

Methods

fromCallable

public static fromCallable(callable|array $callback, mixed $arguments): static
  • This method is static.

Parameters:

Parameter Type Description
$callback callable|array A callable or a [Closure, method] lazy-callable
$arguments mixed

fromStringable

public static fromStringable(string|int|float|bool|\Stringable $value): static
  • This method is static.

Parameters:

Parameter Type Description
$value string|int|float|bool|\Stringable

isStringable

Tells whether the provided value can be cast to string.

final public static isStringable(mixed $value): bool
  • This method is static.

  • This method is final.

Parameters:

Parameter Type Description
$value mixed

resolve

Casts scalars and stringable objects to strings.

final public static resolve(\Stringable|string|int|float|bool $value): string
  • This method is static.

  • This method is final.

Parameters:

Parameter Type Description
$value \Stringable|string|int|float|bool

__toString

public __toString(): string

__sleep

public __sleep(): array

jsonSerialize

public jsonSerialize(): string

__construct

private __construct(): mixed

getPrettyName

private static getPrettyName(callable $callback): string
  • This method is static.

Parameters:

Parameter Type Description
$callback callable