Skip to content

Commit c44926d

Browse files
author
Alessandro Chitolina
committed
override socket select call to silence warnings
1 parent fd16740 commit c44926d

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

src/Connection/ConnectionManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Fazland\Rabbitd\Connection;
44

5+
use Fazland\Rabbitd\PhpAmqpLib\Connection\AMQPSocketConnection;
56
use PhpAmqpLib\Connection\AbstractConnection;
6-
use PhpAmqpLib\Connection\AMQPSocketConnection;
77

88
class ConnectionManager
99
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
namespace Fazland\Rabbitd\PhpAmqpLib\Connection;
4+
5+
use Fazland\Rabbitd\PhpAmqpLib\IO\SocketIO;
6+
use PhpAmqpLib\Connection\AbstractConnection;
7+
8+
class AMQPSocketConnection extends AbstractConnection
9+
{
10+
/**
11+
* @param string $host
12+
* @param int $port
13+
* @param string $user
14+
* @param string $password
15+
* @param string $vhost
16+
* @param bool $insist
17+
* @param string $login_method
18+
* @param null $login_response
19+
* @param string $locale
20+
* @param float $timeout
21+
* @param bool $keepalive
22+
*/
23+
public function __construct(
24+
$host,
25+
$port,
26+
$user,
27+
$password,
28+
$vhost = '/',
29+
$insist = false,
30+
$login_method = 'AMQPLAIN',
31+
$login_response = null,
32+
$locale = 'en_US',
33+
$timeout = 3,
34+
$keepalive = false
35+
) {
36+
$io = new SocketIO($host, $port, $timeout, $keepalive);
37+
38+
parent::__construct(
39+
$user,
40+
$password,
41+
$vhost,
42+
$insist,
43+
$login_method,
44+
$login_response,
45+
$locale,
46+
$io
47+
);
48+
}
49+
}

src/PhpAmqpLib/IO/SocketIO.php

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Fazland\Rabbitd\PhpAmqpLib\IO;
4+
5+
use PhpAmqpLib\Wire\IO\SocketIO as BaseIO;
6+
7+
class SocketIO extends BaseIO
8+
{
9+
public function select($sec, $usec)
10+
{
11+
$read = array($this->getSocket());
12+
$write = null;
13+
$except = null;
14+
15+
return @socket_select($read, $write, $except, $sec, $usec);
16+
}
17+
}

0 commit comments

Comments
 (0)