8000 Remove unused methods · symfony/symfony@c1b34d7 · GitHub
[go: up one dir, main page]

Skip to content

Commit c1b34d7

Browse files
committed
Remove unused methods
1 parent 321b907 commit c1b34d7

File tree

2 files changed

+11
-59
lines changed

2 files changed

+11
-59
lines changed

src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportTest.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,6 @@ public function testSend()
3737
$envelope = new Envelope(new \stdClass());
3838
$this->transport->send($envelope);
3939
$this->assertSame([$envelope], $this->transport->get());
40-
41-
$handler = function (Envelope $env) use ($envelope) {
42-
$this->assertSame($env, $envelope);
43-
};
44-
45-
$this->transport->receive($handler);
46-
47-
$this->transport->send($envelope);
48-
$this->transport->stop();
49-
50-
$this->transport->receive(function (): void {
51-
$this->fail('Should not be reached');
52-
});
5340
}
5441

5542
public function testAck()
@@ -79,11 +66,4 @@ public function testReset()
7966
$this->assertEmpty($this->transport->getAcknowledged(), 'Should be empty after reset');
8067
$this->assertEmpty($this->transport->getRejected(), 'Should be empty after reset');
8168
}
82-
83-
public function testIsStopped()
84-
{
85-
$this->assertFalse($this->transport->isStopped(), 'Transport should be active by default');
86-
$this->transport->stop();
87-
$this->assertTrue($this->transport->isStopped(), 'Transport should be stopped');
88-
}
8969
}

src/Symfony/Component/Messenger/Transport/InMemoryTransport.php

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ class InMemoryTransport implements TransportInterface, ResetInterface
2828
*/
2929
private $sent = [];
3030

31-
/**
32-
* Is the transport stopped?
33-
*
34-
* @var bool
35-
*/
36-
private $stopped = false;
37-
3831
/**
3932
* @var Envelope[]
4033
*/
@@ -48,23 +41,25 @@ class InMemoryTransport implements TransportInterface, ResetInterface
4841
/**
4942
* {@inheritdoc}
5043
*/
51-
public function receive(callable $handler): void
44+
public function get(): iterable
5245
{
53-
if ($this->stopped) {
54-
return;
55-
}
46+
return $this->sent;
47+
}
5648

57-
foreach ($this->sent as $envelope) {
58-
$handler($envelope);
59-
}
49+
/**
50+
* {@inheritdoc}
51+
*/
52+
public function ack(Envelope $envelope): void
53+
{
54+
$this->acknowledged[] = $envelope;
6055
}
6156

6257
/**
6358
* {@inheritdoc}
6459
*/
65-
public function stop(): void
60+
public function reject(Envelope $envelope): void
6661
{
67-
$this->stopped = true;
62+
$this->rejected[] = $envelope;
6863
}
6964

7065
/**
@@ -77,26 +72,11 @@ public function send(Envelope $envelope): Envelope
7772
return $envelope;
7873
}
7974

80-
public function isStopped(): bool
81-
{
82-
return $this->stopped;
83-
}
84-
8575
public function reset()
8676
{
8777
$this->sent = $this->rejected = $this->acknowledged = [];
8878
}
8979

90-
public function ack(Envelope $envelope): void
91-
{
92-
$this->acknowledged[] = $envelope;
93-
}
94-
95-
public function reject(Envelope $envelope): void
96-
{
97-
$this->rejected[] = $envelope;
98-
}
99-
10080
/**
10181
* @return Envelope[]
10282
*/
@@ -112,12 +92,4 @@ public function getRejected(): array
11292
{
11393
return $this->rejected;
11494
}
115-
116-
/**
117-
* {@inheritdoc}
118-
*/
119-
public function get(): iterable
120-
{
121-
return $this->sent;
122-
}
12395
}

0 commit comments

Comments
 (0)
0