HashSetMultiple.php 569 B

123456789101112131415161718192021
  1. <?php
  2. namespace Predis\Commands;
  3. use Predis\Command;
  4. class HashSetMultiple extends Command {
  5. public function getCommandId() { return 'HMSET'; }
  6. public function filterArguments(Array $arguments) {
  7. if (count($arguments) === 2 && is_array($arguments[1])) {
  8. $flattenedKVs = array($arguments[0]);
  9. $args = $arguments[1];
  10. foreach ($args as $k => $v) {
  11. $flattenedKVs[] = $k;
  12. $flattenedKVs[] = $v;
  13. }
  14. return $flattenedKVs;
  15. }
  16. return $arguments;
  17. }
  18. }