Skip to content
docsv0.19.1

ResultBudget

A transport-owned bound on the serialized result, never an authorization grant.

ResultBudget::__construct()

public function __construct(int $maxCharacters, Closure $encoder):

Parameters

Parameters of __construct()
NameTypeDescription
$maxCharactersint
$encoder\Closure(mixed): stringThe same encoder the transport uses for this result.

ResultBudget::json()

public static function json(int $maxCharacters): self

The JSON array encoding used by the model tool loop, with Unicode preserved.

Parameters

Parameters of json()
NameTypeDescription
$maxCharactersint

ResultBudget::encode()

public function encode(?mixed $value): string

Encode with the transport's ruler; source bytes and JSON characters are different units.

Parameters

Parameters of encode()
NameTypeDescription
$value?mixed

ResultBudget::fits()

public function fits(?mixed $value): bool

Whether the entire encoded result fits, including its metadata.

Parameters

Parameters of fits()
NameTypeDescription
$value?mixed

ResultBudget::tightenedTo()

public function tightenedTo(int $maxCharacters): self

A producer may request less room; it cannot expand the transport's allowance.

Parameters

Parameters of tightenedTo()
NameTypeDescription
$maxCharactersint