From 8df3db566a3a937b45ebf11adb90d265e6f5e2d4 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 17 Nov 2019 20:45:02 +0100 Subject: initial checking of customized version 1.0rc9 --- .../src/Guzzle/Http/IoEmittingEntityBody.php | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 vendor/guzzle/guzzle/src/Guzzle/Http/IoEmittingEntityBody.php (limited to 'vendor/guzzle/guzzle/src/Guzzle/Http/IoEmittingEntityBody.php') diff --git a/vendor/guzzle/guzzle/src/Guzzle/Http/IoEmittingEntityBody.php b/vendor/guzzle/guzzle/src/Guzzle/Http/IoEmittingEntityBody.php new file mode 100644 index 0000000..4cc17a8 --- /dev/null +++ b/vendor/guzzle/guzzle/src/Guzzle/Http/IoEmittingEntityBody.php @@ -0,0 +1,83 @@ +eventDispatcher = $eventDispatcher; + + return $this; + } + + public function getEventDispatcher() + { + if (!$this->eventDispatcher) { + $this->eventDispatcher = new EventDispatcher(); + } + + return $this->eventDispatcher; + } + + public function dispatch($eventName, array $context = array()) + { + return $this->getEventDispatcher()->dispatch($eventName, new Event($context)); + } + + /** + * {@inheritdoc} + * @codeCoverageIgnore + */ + public function addSubscriber(EventSubscriberInterface $subscriber) + { + $this->getEventDispatcher()->addSubscriber($subscriber); + + return $this; + } + + public function read($length) + { + $event = array( + 'body' => $this, + 'length' => $length, + 'read' => $this->body->read($length) + ); + $this->dispatch('body.read', $event); + + return $event['read']; + } + + public function write($string) + { + $event = array( + 'body' => $this, + 'write' => $string, + 'result' => $this->body->write($string) + ); + $this->dispatch('body.write', $event); + + return $event['result']; + } +} -- cgit v1.2.3-54-g00ecf