PHP 클래스 mpyw\Co\Co

상속: implements mpyw\Co\CoInterface
파일 보기 프로젝트 열기: mpyw/co 1 사용 예제들

공개 메소드들

메소드 설명
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