mxmbsocket/tests/helpers/Ratchet/Mock/Component.php
2025-04-09 14:56:59 +08:00

36 lines
1.0 KiB
PHP

<?php
namespace mfmdevsystem\socket\Mock;
use mfmdevsystem\socket\MessageComponentInterface;
use mfmdevsystem\socket\WebSocket\WsServerInterface;
use mfmdevsystem\socket\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;
}
}