HashSetMultiple.php 802 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /*
  3. * This file is part of the Predis package.
  4. *
  5. * (c) Daniele Alessandri <suppakilla@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Predis\Commands;
  11. class HashSetMultiple extends Command
  12. {
  13. public function getId()
  14. {
  15. return 'HMSET';
  16. }
  17. protected function filterArguments(Array $arguments)
  18. {
  19. if (count($arguments) === 2 && is_array($arguments[1])) {
  20. $flattenedKVs = array($arguments[0]);
  21. $args = $arguments[1];
  22. foreach ($args as $k => $v) {
  23. $flattenedKVs[] = $k;
  24. $flattenedKVs[] = $v;
  25. }
  26. return $flattenedKVs;
  27. }
  28. return $arguments;
  29. }
  30. }