responses = $responses; $this->deserialize = $deserialize; if (is_null($status)) { $status = new MockStatus(Code::OK); } $this->status = $status; } public function responses() { while (count($this->responses) > 0) { $resp = array_shift($this->responses); $obj = $this->deserializeMessage($resp, $this->deserialize); yield $obj; } } public function getStatus() { if (count($this->responses) > 0) { throw new ApiException( "Calls to getStatus() will block if all responses are not read", Grpc\STATUS_INTERNAL ); } return $this->status; } }