Skip to content

Commit a6551c8

Browse files
committed
Merge pull request clue#21 from clue/data
Rename "message" event to "data" event
2 parents 34466dc + fb1d9e7 commit a6551c8

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

examples/cli.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
$factory->createClient()->then(function (Client $client) use ($loop) {
1919
echo '# connected! Entering interactive mode, hit CTRL-D to quit' . PHP_EOL;
2020

21-
$client->on('message', function (ModelInterface $data) {
21+
$client->on('data', function (ModelInterface $data) {
2222
if ($data instanceof ErrorReply) {
2323
echo '# error reply: ' . $data->getMessage() . PHP_EOL;
2424
} else {

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/**
1010
* Simple interface for executing redis commands
1111
*
12-
* @event message(ModelInterface $model, Client $thisClient)
12+
* @event data(ModelInterface $messageModel, Client $thisClient)
1313
* @event close()
1414
*/
1515
interface Client extends EventEmitterInterface

src/StreamingClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function __call($name, $args)
8383

8484
public function handleMessage(ModelInterface $message)
8585
{
86-
$this->emit('message', array($message, $this));
86+
$this->emit('data', array($message, $this));
8787

8888
if (!$this->requests) {
8989
throw new UnderflowException('Unexpected reply received, no matching request found');

tests/StreamingClientTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ public function testReceiveParseErrorEmitsErrorEvent()
5555

5656
public function testReceiveMessageEmitsEvent()
5757
{
58-
$this->client->on('message', $this->expectCallableOnce());
58+
$this->client->on('data', $this->expectCallableOnce());
5959

6060
$this->parser->expects($this->once())->method('pushIncoming')->with($this->equalTo('message'))->will($this->returnValue(array(new IntegerReply(2))));
6161
$this->stream->emit('data', array('message'));
6262
}
6363

6464
public function testReceiveThrowMessageEmitsErrorEvent()
6565
{
66-
$this->client->on('message', $this->expectCallableOnce());
67-
$this->client->on('message', function() {
66+
$this->client->on('data', $this->expectCallableOnce());
67+
$this->client->on('data', function() {
6868
throw new UnderflowException();
6969
});
7070

0 commit comments

Comments
 (0)