PHP Класс mpyw\Co\Co

Наследование: implements mpyw\Co\CoInterface
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
all ( mixed $value ) : Generator Wrap value with the Generator that returns the all results.
any ( mixed $value ) : Generator Wrap value with the Generator that returns the first successful result.
async ( mixed $value, mixed $throw = null ) Value is recursively resolved, but we never wait it.
getDefaultOptions ( ) : array Get CoOption default as array.
isRunning ( ) : boolean Return if Co::wait() is running.
race ( mixed $value ) : Generator Wrap value with the Generator that returns the first result.
setDefaultOptions ( array $options ) Overwrite CoOption default.
wait ( mixed $value, array $options = [] ) : mixed Wait until value is recursively resolved to return it.

Приватные методы

Метод Описание
__construct ( ) External instantiation is forbidden.
getRootGenerator ( mixed $throw, mixed $value, &$return ) Return root wrapper generator.
processGeneratorContainer ( GeneratorContainer $gc ) : React\Promise\PromiseInterface Handle resolving generators.
processGeneratorContainerDone ( GeneratorContainer $gc ) : React\Promise\PromiseInterface Handle resolving generators already done.
processGeneratorContainerRunning ( GeneratorContainer $gc ) : React\Promise\PromiseInterface Handle resolving generators still running.
promiseAll ( array $yieldables, boolean $throw_acceptable ) : React\Promise\PromiseInterface Promise all changes in yieldables are prepared.
start ( mixed $value, boolean $wait = true, mixed $throw = null ) Start resovling.

Описание методов

all() публичный статический Метод

Normally you don't have to use this method, just yield an array that contains yieldables. You should use only with Co::race() or Co::any().
public static all ( mixed $value ) : Generator
$value mixed
Результат Generator Resolved value.

any() публичный статический Метод

If all yieldables failed, AllFailedException is thrown. If no yieldables found, AllFailedException is thrown.
public static any ( mixed $value ) : Generator
$value mixed
Результат Generator Resolved value.

async() публичный статический Метод

This function must be called along with Co::wait().
public static async ( mixed $value, mixed $throw = null )
$value mixed
$throw mixed

getDefaultOptions() публичный статический Метод

Get CoOption default as array.
public static getDefaultOptions ( ) : array
Результат array

isRunning() публичный статический Метод

Return if Co::wait() is running.
public static isRunning ( ) : boolean
Результат boolean

race() публичный статический Метод

If no yieldables found, AllFailedException is thrown.
public static race ( mixed $value ) : Generator
$value mixed
Результат Generator Resolved value.

setDefaultOptions() публичный статический Метод

Overwrite CoOption default.
public static setDefaultOptions ( array $options )
$options array

wait() публичный статический Метод

This function call must be atomic.
public static wait ( mixed $value, array $options = [] ) : mixed
$value mixed
$options array
Результат mixed