Skip to content

Commit

Permalink
Rename Predis\Client::raw() to Predis\Client::executeRaw().
Browse files Browse the repository at this point in the history
This is more consistent with Predis\Client::executeRaw() and its more
explicit since simply "raw" as a method name was a bit too vague even
despite being nicely short.
  • Loading branch information
nrk committed Dec 14, 2013
1 parent fded76b commit cbf0151
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ v0.9.0 (201x-xx-xx)
they can also define the needed logic in their command classes by implementing
`Predis\Command\PrefixableCommandInterface` just like before.

- The client can now send raw commands using the `Predis\Client::raw()` method.
- The client can now send raw commands using `Predis\Client::executeRaw()`.


v0.8.5 (2013-xx-xx)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ responses. Users must provide the arguments list as an array, following the comm
defined by the [Redis documentation for commands](https://redis.io/commands):

```php
$response = $client->raw(['SET', 'foo', 'bar']);
$response = $client->executeRaw(['SET', 'foo', 'bar']);
```


Expand Down
4 changes: 3 additions & 1 deletion examples/SendingRedisCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
// commands to Redis the usual way and the "raw" way is that in the latter case
// their arguments are not filtered nor responses coming from Redis are parsed.

$response = $client->raw(array('MGET', 'uid:0001', 'uid:0002', 'uid:0003'));
$response = $client->executeRaw(array(
'MGET', 'uid:0001', 'uid:0002', 'uid:0003'
));

var_export($response); echo PHP_EOL;
/* OUTPUT:
Expand Down
2 changes: 1 addition & 1 deletion lib/Predis/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public function getConnectionById($connectionID)
* @param bool $error Set to TRUE when Redis returned an error response.
* @return mixed
*/
public function raw(array $arguments, &$error = null)
public function executeRaw(array $arguments, &$error = null)
{
$error = false;

Expand Down
12 changes: 6 additions & 6 deletions tests/Predis/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,11 @@ public function testRawCommand()

$client = new Client($connection);

$this->assertSame('OK', $client->raw(array('SET', 'foo', 'bar')));
$this->assertSame('bar', $client->raw(array('GET', 'foo')));
$this->assertSame('OK', $client->executeRaw(array('SET', 'foo', 'bar')));
$this->assertSame('bar', $client->executeRaw(array('GET', 'foo')));

$error = true; // $error is always populated by reference.
$this->assertSame('PONG', $client->raw(array('PING'), $error));
$this->assertSame('PONG', $client->executeRaw(array('PING'), $error));
$this->assertFalse($error);
}

Expand All @@ -543,8 +543,8 @@ public function testRawCommandNeverAppliesPrefix()

$client = new Client($connection, array('prefix' => 'predis:'));

$this->assertSame('OK', $client->raw(array('SET', 'foo', 'bar')));
$this->assertSame('bar', $client->raw(array('GET', 'foo')));
$this->assertSame('OK', $client->executeRaw(array('SET', 'foo', 'bar')));
$this->assertSame('bar', $client->executeRaw(array('GET', 'foo')));
}

/**
Expand All @@ -563,7 +563,7 @@ public function testRawCommandNeverThrowsExceptions()

$client = new Client($connection, array('exceptions' => true));

$this->assertSame($message, $client->raw(array('PING'), $error));
$this->assertSame($message, $client->executeRaw(array('PING'), $error));
$this->assertTrue($error);
}

Expand Down

0 comments on commit cbf0151

Please sign in to comment.