summaryrefslogtreecommitdiffstats
path: root/vendor/clue/connection-manager-extra/src/ConnectionManagerSwappable.php
blob: d1332256ba277654da27d089a601ac5cef952af4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
    }
}