Files
Testing/Ratchet/AbstractConnectionDecorator.php
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

42 lines
979 B
PHP

<?php
namespace Ratchet;
/**
* Wraps ConnectionInterface objects via the decorator pattern but allows
* parameters to bubble through with magic methods
* @todo It sure would be nice if I could make most of this a trait...
*/
abstract class AbstractConnectionDecorator implements ConnectionInterface {
/**
* @var ConnectionInterface
*/
protected $wrappedConn;
public function __construct(ConnectionInterface $conn) {
$this->wrappedConn = $conn;
}
/**
* @return ConnectionInterface
*/
protected function getConnection() {
return $this->wrappedConn;
}
public function __set($name, $value) {
$this->wrappedConn->$name = $value;
}
public function __get($name) {
return $this->wrappedConn->$name;
}
public function __isset($name) {
return isset($this->wrappedConn->$name);
}
public function __unset($name) {
unset($this->wrappedConn->$name);
}
}