return $message;
} return null;
} /**
* @return \Generator<int, array>
*/
private function getNextMessages(): \Generator
{ yield from $this->
getPendingMessages();
yield from $this->
getNewMessages();
} /**
* @return \Generator<int, array>
*/
private function getPendingMessages(): \Generator
{ while (!
empty($this->buffer
)) { yield array_shift($this->buffer
);
} }