Skip to content

Commit e8b684e

Browse files
committed
Rename getField() to getFieldValue()
1 parent 4c78061 commit e8b684e

6 files changed

Lines changed: 10 additions & 10 deletions

File tree

example/commands.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
$api->command($line)->then(
3636
function (Response $response) {
37-
echo $response->getField('_') . PHP_EOL;
37+
echo $response->getFieldValue('_') . PHP_EOL;
3838
},
3939
function (Exception $error) use ($line) {
4040
echo 'Error executing "' . $line . '": ' . $error->getMessage() . PHP_EOL;

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function handleMessage(Message $message)
7979
return;
8080
}
8181

82-
if ($message->getField('Response') === 'Error') {
82+
if ($message->getFieldValue('Response') === 'Error') {
8383
$this->pending[$id]->reject(new ErrorException($message));
8484
} else {
8585
$this->pending[$id]->resolve($message);

src/Protocol/ErrorException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ErrorException extends RuntimeException
1010

1111
public function __construct(Response $response)
1212
{
13-
parent::__construct('Error "' . $response->getField('Message') . '"');
13+
parent::__construct('Error "' . $response->getFieldValue('Message') . '"');
1414
$this->response = $response;
1515
}
1616

src/Protocol/Event.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ public function __construct(array $fields)
1111

1212
public function getName()
1313
{
14-
return $this->getField('Event');
14+
return $this->getFieldValue('Event');
1515
}
1616
}

src/Protocol/Message.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ abstract class Message
88

99
public function getActionId()
1010
{
11-
return $this->getField('ActionId');
11+
return $this->getFieldValue('ActionId');
1212
}
1313

14-
public function getField($key)
14+
public function getFieldValue($key)
1515
{
1616
$key = strtolower($key);
1717

tests/Protocol/ParserTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function testParseResponse()
1616
/* @var $first Clue\React\Ami\Protocol\Response */
1717

1818
$this->assertInstanceOf('Clue\React\Ami\Protocol\Response', $first);
19-
$this->assertEquals('Success', $first->getField('Response'));
19+
$this->assertEquals('Success', $first->getFieldValue('Response'));
2020
}
2121

2222
public function testParseResponseSpace()
@@ -31,7 +31,7 @@ public function testParseResponseSpace()
3131
/* @var $first Clue\React\Ami\Protocol\Response */
3232

3333
$this->assertInstanceOf('Clue\React\Ami\Protocol\Response', $first);
34-
$this->assertEquals(' spaces ', $first->getField('Message'));
34+
$this->assertEquals(' spaces ', $first->getFieldValue('Message'));
3535
}
3636

3737
public function testParsingMultipleEvents()
@@ -61,8 +61,8 @@ public function testParsingCommandResponse()
6161
/* @var $first Clue\React\Ami\Protocol\Response */
6262

6363
$this->assertInstanceOf('Clue\React\Ami\Protocol\Response', $first);
64-
$this->assertEquals('Follows', $first->getField('Response'));
65-
$this->assertEquals("Testing: yes\nAnother Line\n--END COMMAND--", $first->getField('_'));
64+
$this->assertEquals('Follows', $first->getFieldValue('Response'));
65+
$this->assertEquals("Testing: yes\nAnother Line\n--END COMMAND--", $first->getFieldValue('_'));
6666
}
6767

6868
/**

0 commit comments

Comments
 (0)