Skip to content

Commit

Permalink
Merge pull request #2 from szepeviktor/patch-1
Browse files Browse the repository at this point in the history
Simplify Generator
  • Loading branch information
betterthanclay committed Nov 19, 2023
2 parents fae61a9 + 77882b1 commit 5515557
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Message/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,9 @@ public function __construct(
$this->fiber = new Fiber($iterator);

while (!$this->fiber->isTerminated()) {
if ($this->fiber->isSuspended()) {
$string = $this->fiber->resume();
} else {
$string = $this->fiber->start($this);
}

yield $string;
yield $this->fiber->isSuspended()
? $this->fiber->resume()
: $this->fiber->start($this);
}

$iterator = $this->fiber->getReturn();
Expand Down

0 comments on commit 5515557

Please sign in to comment.