diff options
Diffstat (limited to 'vendor/clue/connection-manager-extra/src/ConnectionManagerSwappable.php')
-rw-r--r-- | vendor/clue/connection-manager-extra/src/ConnectionManagerSwappable.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/clue/connection-manager-extra/src/ConnectionManagerSwappable.php b/vendor/clue/connection-manager-extra/src/ConnectionManagerSwappable.php new file mode 100644 index 0000000..d133225 --- /dev/null +++ b/vendor/clue/connection-manager-extra/src/ConnectionManagerSwappable.php @@ -0,0 +1,26 @@ +<?php + +namespace ConnectionManager\Extra; + +use React\Socket\ConnectorInterface; + +// connection manager decorator which simplifies exchanging the actual connection manager during runtime +class ConnectionManagerSwappable implements ConnectorInterface +{ + protected $connectionManager; + + public function __construct(ConnectorInterface $connectionManager) + { + $this->connectionManager = $connectionManager; + } + + public function connect($uri) + { + return $this->connectionManager->connect($uri); + } + + public function setConnectionManager(ConnectorInterface $connectionManager) + { + $this->connectionManager = $connectionManager; + } +} |