Request.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Paypal\Model\Payflow;
  7. /**
  8. * Payflow Link request model
  9. *
  10. * @author Magento Core Team <core@magentocommerce.com>
  11. */
  12. class Request extends \Magento\Framework\DataObject
  13. {
  14. /**
  15. * Set/Get attribute wrapper
  16. * Also add length path if key contains = or &
  17. *
  18. * @param string $method
  19. * @param array $args
  20. * @return mixed
  21. * @throws \Magento\Framework\Exception\LocalizedException
  22. * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  23. */
  24. public function __call($method, $args)
  25. {
  26. $key = $this->_underscore(substr($method, 3));
  27. if (isset($args[0]) && (strstr($args[0], '=') || strstr($args[0], '&'))) {
  28. $key .= '[' . strlen($args[0]) . ']';
  29. }
  30. switch (substr($method, 0, 3)) {
  31. case 'get':
  32. //\Magento\Framework\Profiler::start('GETTER: '.get_class($this).'::'.$method);
  33. $data = $this->getData($key, isset($args[0]) ? $args[0] : null);
  34. //\Magento\Framework\Profiler::stop('GETTER: '.get_class($this).'::'.$method);
  35. return $data;
  36. case 'set':
  37. //\Magento\Framework\Profiler::start('SETTER: '.get_class($this).'::'.$method);
  38. $result = $this->setData($key, isset($args[0]) ? $args[0] : null);
  39. //\Magento\Framework\Profiler::stop('SETTER: '.get_class($this).'::'.$method);
  40. return $result;
  41. case 'uns':
  42. //\Magento\Framework\Profiler::start('UNS: '.get_class($this).'::'.$method);
  43. $result = $this->unsetData($key);
  44. //\Magento\Framework\Profiler::stop('UNS: '.get_class($this).'::'.$method);
  45. return $result;
  46. case 'has':
  47. //\Magento\Framework\Profiler::start('HAS: '.get_class($this).'::'.$method);
  48. //\Magento\Framework\Profiler::stop('HAS: '.get_class($this).'::'.$method);
  49. return isset($this->_data[$key]);
  50. }
  51. throw new \Magento\Framework\Exception\LocalizedException(
  52. __("Invalid method %1::%2", get_class($this), $method)
  53. );
  54. }
  55. }