Code Duplication    Length = 22-22 lines in 2 locations

Connection/CmobiAMQPConnection.php 1 location

@@ 7-28 (lines=22) @@
4
5
use PhpAmqpLib\Connection\AMQPStreamConnection;
6
7
class CmobiAMQPConnection extends AMQPStreamConnection implements CmobiAMQPConnectionInterface
8
{
9
    /**
10
     * Fetches a channel object identified by the numeric channel_id, or
11
     * create that object if it doesn't already exist.
12
     *
13
     * @param string $channel_id
14
     * @return CmobiAMQPChannel
15
     */
16
    public function channel($channel_id = null)
17
    {
18
        if (isset($this->channels[$channel_id])) {
19
            return $this->channels[$channel_id];
20
        }
21
22
        $channel_id = $channel_id ? $channel_id : $this->get_free_channel_id();
23
        $ch = new CmobiAMQPChannel($this->connection, $channel_id);
24
        $this->channels[$channel_id] = $ch;
25
26
        return $ch;
27
    }
28
}

Connection/CmobiAMQPLazyConnection.php 1 location

@@ 7-28 (lines=22) @@
4
5
use PhpAmqpLib\Connection\AMQPLazyConnection;
6
7
class CmobiAMQPLazyConnection extends AMQPLazyConnection implements CmobiAMQPConnectionInterface
8
{
9
    /**
10
     * Fetches a channel object identified by the numeric channel_id, or
11
     * create that object if it doesn't already exist.
12
     *
13
     * @param string $channel_id
14
     * @return CmobiAMQPChannel
15
     */
16
    public function channel($channel_id = null)
17
    {
18
        if (isset($this->channels[$channel_id])) {
19
            return $this->channels[$channel_id];
20
        }
21
22
        $channel_id = $channel_id ? $channel_id : $this->get_free_channel_id();
23
        $ch = new CmobiAMQPChannel($this->connection, $channel_id);
24
        $this->channels[$channel_id] = $ch;
25
26
        return $ch;
27
    }
28
}