mxmbsocket/tests/Ratchet/Tests/Mock/Component.php
2013-01-04 19:52:57 -05:00

35 lines
983 B
PHP

<?php
namespace Ratchet\Tests\Mock;
use Ratchet\MessageComponentInterface;
use Ratchet\WebSocket\WsServerInterface;
use Ratchet\ConnectionInterface;
class Component implements MessageComponentInterface, WsServerInterface {
public $last = array();
public $protocols = array();
public function __construct(ComponentInterface $app = null) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onOpen(ConnectionInterface $conn) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onMessage(ConnectionInterface $from, $msg) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onClose(ConnectionInterface $conn) {
$this->last[__FUNCTION__] = func_get_args();
}
public function onError(ConnectionInterface $conn, \Exception $e) {
$this->last[__FUNCTION__] = func_get_args();
}
public function getSubProtocols() {
return $this->protocols;
}
}