Amp\Artax\IteratorWriter::finalizeEventualWriteElement PHP Method

finalizeEventualWriteElement() private method

private finalizeEventualWriteElement ( $current )
    private function finalizeEventualWriteElement($current)
    {
        try {
            $this->writer = $this->writerFactory->make($current);
            $writePromise = $this->writer->write($this->socket, $current);
            $writePromise->watch(function ($update) {
                $this->promisor->update($update);
            });
            $writePromise->when(function ($error, $result) {
                $this->afterElementWrite($error, $result);
            });
        } catch (\Exception $e) {
            // Protect against bad userland iterator return values from Iterator::current()
            $this->promisor->fail($e);
        }
    }