BraintreeTransactionStub.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Braintree\Test\Unit\Model\Report;
  7. /**
  8. * Class BraintreeSearchNodeStub
  9. */
  10. class BraintreeTransactionStub
  11. {
  12. protected $_attributes = [];
  13. /**
  14. * Set attributes array
  15. *
  16. * @param $attrs
  17. * @return void
  18. */
  19. public function setAttributes($attrs)
  20. {
  21. $this->_attributes = $attrs;
  22. }
  23. /**
  24. * Accessor for instance properties stored in the private $_attributes property
  25. *
  26. * @ignore
  27. * @param string $name
  28. * @return mixed
  29. */
  30. public function __get($name)
  31. {
  32. if (array_key_exists($name, $this->_attributes)) {
  33. return $this->_attributes[$name];
  34. }
  35. trigger_error('Undefined property on ' . get_class($this) . ': ' . $name, E_USER_NOTICE);
  36. return null;
  37. }
  38. /**
  39. * Checks for the existance of a property stored in the private $_attributes property
  40. *
  41. * @ignore
  42. * @param string $name
  43. * @return boolean
  44. */
  45. public function __isset($name)
  46. {
  47. return array_key_exists($name, $this->_attributes);
  48. }
  49. /**
  50. * Mutator for instance properties stored in the private $_attributes property
  51. *
  52. * @ignore
  53. * @param string $key
  54. * @param mixed $value
  55. */
  56. public function _set($key, $value)
  57. {
  58. $this->_attributes[$key] = $value;
  59. }
  60. }