Code Duplication    Length = 46-46 lines in 2 locations

PhpAmqpLib/Connection/AMQPLazyConnection.php 1 location

@@ 4-49 (lines=46) @@
1
<?php
2
namespace PhpAmqpLib\Connection;
3
4
class AMQPLazyConnection extends AMQPStreamConnection
5
{
6
    /**
7
     * Gets socket from current connection
8
     *
9
     * @deprecated
10
     */
11
    public function getSocket()
12
    {
13
        $this->connect();
14
15
        return parent::getSocket();
16
    }
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function channel($channel_id = null)
22
    {
23
        $this->connect();
24
25
        return parent::channel($channel_id);
26
    }
27
28
    /**
29
     * @return null|\PhpAmqpLib\Wire\IO\AbstractIO
30
     */
31
    protected function getIO()
32
    {
33
        if (!$this->io) {
34
            $this->connect();
35
        }
36
37
        return $this->io;
38
    }
39
40
    /**
41
     * Should the connection be attempted during construction?
42
     *
43
     * @return bool
44
     */
45
    public function connectOnConstruct()
46
    {
47
        return false;
48
    }
49
}
50

PhpAmqpLib/Connection/AMQPLazySocketConnection.php 1 location

@@ 8-53 (lines=46) @@
5
/**
6
 * Yet another lazy connection. This time using sockets. Current architecture doesn't allow to wrap existing connections
7
 */
8
class AMQPLazySocketConnection extends AMQPSocketConnection
9
{
10
    /**
11
     * Gets socket from current connection
12
     *
13
     * @deprecated
14
     */
15
    public function getSocket()
16
    {
17
        $this->connect();
18
19
        return parent::getSocket();
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function channel($channel_id = null)
26
    {
27
        $this->connect();
28
29
        return parent::channel($channel_id);
30
    }
31
32
    /**
33
     * @return null|\PhpAmqpLib\Wire\IO\AbstractIO
34
     */
35
    protected function getIO()
36
    {
37
        if (!$this->io) {
38
            $this->connect();
39
        }
40
41
        return $this->io;
42
    }
43
44
    /**
45
     * Should the connection be attempted during construction?
46
     *
47
     * @return bool
48
     */
49
    public function connectOnConstruct()
50
    {
51
        return false;
52
    }
53
}