diff options
author | marvin-borner@live.com | 2018-04-16 21:09:05 +0200 |
---|---|---|
committer | marvin-borner@live.com | 2018-04-16 21:09:05 +0200 |
commit | cf14306c2b3f82a81f8d56669a71633b4d4b5fce (patch) | |
tree | 86700651aa180026e89a66064b0364b1e4346f3f /assets/php/vendor/ratchet/rfc6455/src/Messaging/Message.php | |
parent | 619b01b3615458c4ed78bfaeabb6b1a47cc8ad8b (diff) |
Main merge to user management system - files are now at /main/public/
Diffstat (limited to 'assets/php/vendor/ratchet/rfc6455/src/Messaging/Message.php')
-rwxr-xr-x | assets/php/vendor/ratchet/rfc6455/src/Messaging/Message.php | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/assets/php/vendor/ratchet/rfc6455/src/Messaging/Message.php b/assets/php/vendor/ratchet/rfc6455/src/Messaging/Message.php deleted file mode 100755 index 4f3b014..0000000 --- a/assets/php/vendor/ratchet/rfc6455/src/Messaging/Message.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -namespace Ratchet\RFC6455\Messaging; - -class Message implements \IteratorAggregate, MessageInterface { - /** - * @var \SplDoublyLinkedList - */ - private $_frames; - - public function __construct() { - $this->_frames = new \SplDoublyLinkedList; - } - - public function getIterator() { - return $this->_frames; - } - - /** - * {@inheritdoc} - */ - public function count() { - return count($this->_frames); - } - - /** - * {@inheritdoc} - */ - public function isCoalesced() { - if (count($this->_frames) == 0) { - return false; - } - - $last = $this->_frames->top(); - - return ($last->isCoalesced() && $last->isFinal()); - } - - /** - * {@inheritdoc} - */ - public function addFrame(FrameInterface $fragment) { - $this->_frames->push($fragment); - - return $this; - } - - /** - * {@inheritdoc} - */ - public function getOpcode() { - if (count($this->_frames) == 0) { - throw new \UnderflowException('No frames have been added to this message'); - } - - return $this->_frames->bottom()->getOpcode(); - } - - /** - * {@inheritdoc} - */ - public function getPayloadLength() { - $len = 0; - - foreach ($this->_frames as $frame) { - try { - $len += $frame->getPayloadLength(); - } catch (\UnderflowException $e) { - // Not an error, want the current amount buffered - } - } - - return $len; - } - - /** - * {@inheritdoc} - */ - public function getPayload() { - if (!$this->isCoalesced()) { - throw new \UnderflowException('Message has not been put back together yet'); - } - - return $this->__toString(); - } - - /** - * {@inheritdoc} - */ - public function getContents() { - if (!$this->isCoalesced()) { - throw new \UnderflowException("Message has not been put back together yet"); - } - - $buffer = ''; - - foreach ($this->_frames as $frame) { - $buffer .= $frame->getContents(); - } - - return $buffer; - } - - public function __toString() { - $buffer = ''; - - foreach ($this->_frames as $frame) { - $buffer .= $frame->getPayload(); - } - - return $buffer; - } - - /** - * @return boolean - */ - public function isBinary() { - if ($this->_frames->isEmpty()) { - throw new \UnderflowException('Not enough data has been received to determine if message is binary'); - } - - return Frame::OP_BINARY === $this->_frames->bottom()->getOpcode(); - } -} |