PHP Class mpyw\Co\Internal\YieldableUtils

Afficher le fichier Open project: mpyw/co Class Usage Examples

Méthodes publiques

Méthode Description
getApplier ( mixed $yielded, array $yieldables, callable $next = null ) : mixed Return function that apply changes in yieldables.
getYieldables ( mixed $value, array $keylist = [], array &$runners = [] ) : array Recursively search yieldable values.
normalize ( mixed $value, mixed $yield_key = null ) : mixed Recursively normalize value.
safePromise ( React\Promise\PromiseInterface $promise ) : React\Promise\PromiseInterface Return Promise that absorbs rejects, excluding fatal Throwable.

Method Details

getApplier() public static méthode

Return function that apply changes in yieldables.
public static getApplier ( mixed $yielded, array $yieldables, callable $next = null ) : mixed
$yielded mixed
$yieldables array
$next callable
Résultat mixed

getYieldables() public static méthode

Each entries are assoc those contain keys 'value' and 'keylist'. value -> the value itself. keylist -> position of the value. nests are represented as array values.
public static getYieldables ( mixed $value, array $keylist = [], array &$runners = [] ) : array
$value mixed Must be already normalized.
$keylist array Internally used.
$runners array
Résultat array

normalize() public static méthode

Generator Closure -> GeneratorContainer Array -> Array (children's are normalized) Others -> Others
public static normalize ( mixed $value, mixed $yield_key = null ) : mixed
$value mixed
$yield_key mixed
Résultat mixed

safePromise() public static méthode

Return Promise that absorbs rejects, excluding fatal Throwable.
public static safePromise ( React\Promise\PromiseInterface $promise ) : React\Promise\PromiseInterface
$promise React\Promise\PromiseInterface
Résultat React\Promise\PromiseInterface