These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace PhpAmqpLib\Connection; |
||
4 | |||
5 | /** |
||
6 | * Yet another lazy connection. This time using sockets. Current architecture doesn't allow to wrap existing connections |
||
7 | */ |
||
8 | View Code Duplication | class AMQPLazySocketConnection extends AMQPSocketConnection |
|
0 ignored issues
–
show
|
|||
9 | { |
||
10 | /** |
||
11 | * {@inheritdoc} |
||
12 | */ |
||
13 | 2 | public function channel($channel_id = null) |
|
14 | { |
||
15 | 2 | $this->connect(); |
|
16 | |||
17 | 2 | return parent::channel($channel_id); |
|
18 | } |
||
19 | |||
20 | /** |
||
21 | * @return null|\PhpAmqpLib\Wire\IO\AbstractIO |
||
22 | */ |
||
23 | public function getIO() |
||
24 | { |
||
25 | if (empty($this->io)) { |
||
26 | $this->connect(); |
||
27 | } |
||
28 | |||
29 | return $this->io; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Should the connection be attempted during construction? |
||
34 | * |
||
35 | * @return bool |
||
36 | */ |
||
37 | 2 | public function connectOnConstruct() |
|
38 | { |
||
39 | 2 | return false; |
|
40 | } |
||
41 | } |
||
42 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.