Skip to content

Commit b7a1a30

Browse files
committed
[Messenger] Use CPP
1 parent 638bef4 commit b7a1a30

File tree

6 files changed

+30
-34
lines changed

6 files changed

+30
-34
lines changed

Tests/Fixtures/DummyMessage.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44

55
class DummyMessage
66
{
7-
private string $message;
8-
9-
public function __construct(string $message)
10-
{
11-
$this->message = $message;
7+
public function __construct(
8+
private string $message,
9+
) {
1210
}
1311

1412
public function getMessage(): string

Transport/BeanstalkdReceivedStamp.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@
1818
*/
1919
class BeanstalkdReceivedStamp implements NonSendableStampInterface
2020
{
21-
private string $id;
22-
private string $tube;
23-
24-
public function __construct(string $id, string $tube)
25-
{
26-
$this->id = $id;
27-
$this->tube = $tube;
21+
public function __construct(
22+
private string $id,
23+
private string $tube,
24+
) {
2825
}
2926

3027
public function getId(): string

Transport/BeanstalkdReceiver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
*/
2525
class BeanstalkdReceiver implements ReceiverInterface, MessageCountAwareInterface
2626
{
27-
private Connection $connection;
2827
private SerializerInterface $serializer;
2928

30-
public function __construct(Connection $connection, ?SerializerInterface $serializer = null)
31-
{
32-
$this->connection = $connection;
29+
public function __construct(
30+
private Connection $connection,
31+
?SerializerInterface $serializer = null,
32+
) {
3333
$this->serializer = $serializer ?? new PhpSerializer();
3434
}
3535

Transport/BeanstalkdSender.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
*/
2323
class BeanstalkdSender implements SenderInterface
2424
{
25-
private Connection $connection;
2625
private SerializerInterface $serializer;
2726

28-
public function __construct(Connection $connection, ?SerializerInterface $serializer = null)
29-
{
30-
$this->connection = $connection;
27+
public function __construct(
28+
private Connection $connection,
29+
?SerializerInterface $serializer = null,
30+
) {
3131
$this->serializer = $serializer ?? new PhpSerializer();
3232
}
3333

Transport/BeanstalkdTransport.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
*/
2323
class BeanstalkdTransport implements TransportInterface, MessageCountAwareInterface
2424
{
25-
private Connection $connection;
2625
private SerializerInterface $serializer;
2726
private BeanstalkdReceiver $receiver;
2827
private BeanstalkdSender $sender;
2928

30-
public function __construct(Connection $connection, ?SerializerInterface $serializer = null)
31-
{
32-
$this->connection = $connection;
29+
public function __construct(
30+
private Connection $connection,
31+
?SerializerInterface $serializer = null,
32+
) {
3333
$this->serializer = $serializer ?? new PhpSerializer();
3434
}
3535

Transport/Connection.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,24 @@ class Connection
3434
'ttr' => 90,
3535
];
3636

37+
private string $tube;
38+
private int $timeout;
39+
private int $ttr;
40+
3741
/**
38-
* Available options:.
42+
* Constructor.
43+
*
44+
* Available options:
3945
*
4046
* * tube_name: name of the tube
4147
* * timeout: message reservation timeout (in seconds)
4248
* * ttr: the message time to run before it is put back in the ready queue (in seconds)
4349
*/
44-
private array $configuration;
45-
private PheanstalkInterface $client;
46-
private string $tube;
47-
private int $timeout;
48-
private int $ttr;
49-
50-
public function __construct(array $configuration, PheanstalkInterface $client)
51-
{
50+
public function __construct(
51+
private array $configuration,
52+
private PheanstalkInterface $client,
53+
) {
5254
$this->configuration = array_replace_recursive(self::DEFAULT_OPTIONS, $configuration);
53-
$this->client = $client;
5455
$this->tube = $this->configuration['tube_name'];
5556
$this->timeout = $this->configuration['timeout'];
5657
$this->ttr = $this->configuration['ttr'];

0 commit comments

Comments
 (0)