Predis\Command\Command::normalizeVariadic PHP 메소드

normalizeVariadic() 공개 정적인 메소드

Normalizes the arguments array passed to a variadic Redis command.
public static normalizeVariadic ( array $arguments ) : array
$arguments array Arguments for a command.
리턴 array
    public static function normalizeVariadic(array $arguments)
    {
        if (count($arguments) === 2 && is_array($arguments[1])) {
            return array_merge(array($arguments[0]), $arguments[1]);
        }
        return $arguments;
    }

Usage Example

예제 #1
0
 /**
  * @group disconnected
  */
 public function testNormalizeVariadic()
 {
     $arguments = array('key', 'value1', 'value2', 'value3');
     $this->assertSame($arguments, Command::normalizeVariadic($arguments));
     $this->assertSame($arguments, Command::normalizeVariadic(array('key', array('value1', 'value2', 'value3'))));
     $arguments = array(new \stdClass());
     $this->assertSame($arguments, Command::normalizeVariadic($arguments));
 }