ArgumentProcessor.php 1016 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Amqp\Topology;
  7. /**
  8. * @deprecated 102.0.1
  9. * see: https://github.com/php-amqplib/php-amqplib/issues/405
  10. */
  11. trait ArgumentProcessor
  12. {
  13. /**
  14. * Process arguments
  15. *
  16. * @param array $arguments
  17. * @return array
  18. */
  19. public function processArguments($arguments)
  20. {
  21. $output = [];
  22. foreach ($arguments as $key => $value) {
  23. if (is_array($value)) {
  24. $output[$key] = ['A', $value];
  25. } elseif (is_int($value)) {
  26. $output[$key] = ['I', $value];
  27. } elseif (is_bool($value)) {
  28. $output[$key] = ['t', $value];
  29. } elseif (is_string($value)) {
  30. $output[$key] = ['S', $value];
  31. } else {
  32. throw new \InvalidArgumentException('Unknown argument type ' . gettype($value));
  33. }
  34. }
  35. return $output;
  36. }
  37. }