PHP Class mpyw\Co\Internal\ControlUtils

Datei anzeigen Open project: mpyw/co Class Usage Examples

Public Methods

Method Description
anyOrRace ( mixed $value, callable $filter, string $message ) : Generator Executed by Co::any() or Co::race().
fail ( mixed $yieldable ) : Generator Handle success as ControlException.
getWrapperGenerator ( array $yieldables, callable $filter ) : Generator Wrap yieldables with specified filter function.
reverse ( mixed $yieldable ) : Generator Handle success as ControlException, failure as resolved.

Method Details

anyOrRace() public static method

Executed by Co::any() or Co::race().
public static anyOrRace ( mixed $value, callable $filter, string $message ) : Generator
$value mixed
$filter callable self::reverse or self::fail.
$message string Used for failure.
return Generator

fail() public static method

Handle success as ControlException.
public static fail ( mixed $yieldable ) : Generator
$yieldable mixed
return Generator

getWrapperGenerator() public static method

Wrap yieldables with specified filter function.
public static getWrapperGenerator ( array $yieldables, callable $filter ) : Generator
$yieldables array
$filter callable self::reverse or self::fail.
return Generator

reverse() public static method

Handle success as ControlException, failure as resolved.
public static reverse ( mixed $yieldable ) : Generator
$yieldable mixed
return Generator