mpyw\Co\Internal\GeneratorContainer::valid PHP Method

valid() public method

Return whether generator is actually working.
public valid ( ) : boolean
return boolean
    public function valid()
    {
        try {
            $this->g->current();
            return $this->e === null && $this->g->valid() && $this->g->key() !== CoInterface::RETURN_WITH;
        } catch (\Throwable $e) {
        } catch (\Exception $e) {
        }
        $this->e = $e;
        return false;
    }

Usage Example

Beispiel #1
0
Datei: Co.php Projekt: mpyw/co
 /**
  * Handle resolving generators.
  * @param  GeneratorContainer $gc
  * @return PromiseInterface
  */
 private function processGeneratorContainer(GeneratorContainer $gc)
 {
     return $gc->valid() ? $this->processGeneratorContainerRunning($gc) : $this->processGeneratorContainerDone($gc);
 }
All Usage Examples Of mpyw\Co\Internal\GeneratorContainer::valid