mpyw\Co\Co::wait PHP Method

wait() public static method

This function call must be atomic.
public static wait ( mixed $value, array $options = [] ) : mixed
$value mixed
$options array
return mixed
    public static function wait($value, array $options = [])
    {
        try {
            if (self::$self) {
                throw new \BadMethodCallException('Co::wait() is already running. Use Co::async() instead.');
            }
            self::$self = new self();
            self::$self->options = new CoOption($options);
            self::$self->pool = new Pool(self::$self->options);
            return self::$self->start($value);
        } finally {
            self::$self = null;
        }
        // @codeCoverageIgnoreStart
    }

Usage Example

Ejemplo n.º 1
0
 public function testCollectAsyncFollowersIds()
 {
     Co::wait(function () {
         $this->assertTrue((yield $this->getBot()->forceMutualsAsync()));
         $this->assertEquals(['UNFOLLOWED: @11', 'FOLLOWED: @1', 'FOLLOWED: @2', 'FOLLOWED: @3', 'FOLLOWED: @7'], $GLOBALS['HARDBOTTER-BUFFER-OUTS']);
     });
 }
All Usage Examples Of mpyw\Co\Co::wait