normalizeArguments() public static méthode

Normalizes the arguments array passed to a Redis command.
public static normalizeArguments ( array $arguments ) : array
$arguments array Arguments for a command.
Résultat array
 /**
  * @group disconnected
  */
 public function testNormalizeArguments()
 {
     $arguments = array('arg1', 'arg2', 'arg3', 'arg4');
     $this->assertSame($arguments, Command::normalizeArguments($arguments));
     $this->assertSame($arguments, Command::normalizeArguments(array($arguments)));
     $arguments = array(array(), array());
     $this->assertSame($arguments, Command::normalizeArguments($arguments));
     $arguments = array(new \stdClass());
     $this->assertSame($arguments, Command::normalizeArguments($arguments));
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 protected function writeRequest($method, $arguments)
 {
     $this->client->getConnection()->writeRequest($this->client->createCommand($method, Command::normalizeArguments($arguments)));
 }
Exemple #3
0
 /**
  * Writes a Redis command on the underlying connection.
  *
  * @param string   $method    Command ID.
  * @param array    $arguments Arguments for the command.
  * @param callable $callback  Optional callback.
  */
 protected function writeRequest($method, $arguments, callable $callback = null)
 {
     $arguments = Command::normalizeArguments($arguments ?: []);
     $command = $this->client->createCommand($method, $arguments);
     $this->client->executeCommand($command, $callback);
 }