1: <?php
2: namespace Ratchet;
3:
4: /**
5: * Wraps ConnectionInterface objects via the decorator pattern but allows
6: * parameters to bubble through with magic methods
7: * @todo It sure would be nice if I could make most of this a trait...
8: */
9: abstract class AbstractConnectionDecorator implements ConnectionInterface {
10: /**
11: * @var ConnectionInterface
12: */
13: protected $wrappedConn;
14:
15: public function __construct(ConnectionInterface $conn) {
16: $this->wrappedConn = $conn;
17: }
18:
19: /**
20: * @return ConnectionInterface
21: */
22: protected function getConnection() {
23: return $this->wrappedConn;
24: }
25:
26: public function __set($name, $value) {
27: $this->wrappedConn->$name = $value;
28: }
29:
30: public function __get($name) {
31: return $this->wrappedConn->$name;
32: }
33:
34: public function __isset($name) {
35: return isset($this->wrappedConn->$name);
36: }
37:
38: public function __unset($name) {
39: unset($this->wrappedConn->$name);
40: }
41: }
42: