Skip to content

Commit c9d1038

Browse files
Allow to use SSL connection as lazy (php-amqplib#893)
* added AMQPLazySSLConnection Allows to have lazy ssl connection * dropped deprecated method
1 parent e9dbc8e commit c9d1038

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace PhpAmqpLib\Connection;
4+
5+
class AMQPLazySSLConnection extends AMQPSSLConnection
6+
{
7+
/**
8+
* {@inheritdoc}
9+
*/
10+
public function channel($channel_id = null)
11+
{
12+
$this->connect();
13+
14+
return parent::channel($channel_id);
15+
}
16+
17+
/**
18+
* @return null|\PhpAmqpLib\Wire\IO\AbstractIO
19+
*/
20+
public function getIO()
21+
{
22+
if (empty($this->io)) {
23+
$this->connect();
24+
}
25+
26+
return $this->io;
27+
}
28+
29+
/**
30+
* Should the connection be attempted during construction?
31+
*
32+
* @return bool
33+
*/
34+
public function connectOnConstruct()
35+
{
36+
return false;
37+
}
38+
}

0 commit comments

Comments
 (0)