PrefixHelpers.php 746 B

12345678910111213141516171819202122232425262728293031323334
  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 PrefixHelpers
  12. {
  13. public static function multipleKeys(Array $arguments, $prefix)
  14. {
  15. foreach ($arguments as &$key) {
  16. $key = "$prefix$key";
  17. }
  18. return $arguments;
  19. }
  20. public static function skipLastArgument(Array $arguments, $prefix)
  21. {
  22. $length = count($arguments);
  23. for ($i = 0; $i < $length - 1; $i++) {
  24. $arguments[$i] = "$prefix{$arguments[$i]}";
  25. }
  26. return $arguments;
  27. }
  28. }