Spiking SPL interfaces
This commit is contained in:
parent
5e79598448
commit
c1027be9a6
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Ratchet\RFC6455\Messaging\Protocol;
|
namespace Ratchet\RFC6455\Messaging\Protocol;
|
||||||
|
|
||||||
class Message implements MessageInterface, \Countable {
|
class Message implements MessageInterface {
|
||||||
/**
|
/**
|
||||||
* @var \SplDoublyLinkedList
|
* @var \SplDoublyLinkedList
|
||||||
*/
|
*/
|
||||||
protected $_frames;
|
private $_frames;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->_frames = new \SplDoublyLinkedList;
|
$this->_frames = new \SplDoublyLinkedList;
|
||||||
@ -18,6 +18,22 @@ class Message implements MessageInterface, \Countable {
|
|||||||
return count($this->_frames);
|
return count($this->_frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function offsetExists($index) {
|
||||||
|
return $this->_frames->offsetExists($index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetGet($index) {
|
||||||
|
return $this->_frames->offsetGet($index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetSet($index, $newval) {
|
||||||
|
throw new \DomainException('Frame access in messages is read-only');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetUnset($index) {
|
||||||
|
throw new \DomainException('Frame access in messages is read-only');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Ratchet\RFC6455\Messaging\Protocol;
|
namespace Ratchet\RFC6455\Messaging\Protocol;
|
||||||
|
|
||||||
interface MessageInterface extends DataInterface {
|
interface MessageInterface extends DataInterface, \ArrayAccess, \Countable {
|
||||||
/**
|
/**
|
||||||
* @param FrameInterface $fragment
|
* @param FrameInterface $fragment
|
||||||
* @return MessageInterface
|
* @return MessageInterface
|
||||||
|
Loading…
Reference in New Issue
Block a user