DataObject.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Reflection\Test\Unit;
  7. use Magento\Framework\Reflection\Test\Unit\Fixture\TSampleInterface;
  8. /**
  9. * Dummy data object to be used by TypeProcessorTest
  10. */
  11. class DataObject
  12. {
  13. /**
  14. * @var string
  15. */
  16. private $attrName;
  17. /**
  18. * @var bool
  19. */
  20. private $isActive;
  21. /**
  22. * @var string
  23. */
  24. private $name;
  25. /**
  26. * @var array
  27. */
  28. private $data = [];
  29. /**
  30. * @return string
  31. */
  32. public function getAttrName()
  33. {
  34. return $this->attrName;
  35. }
  36. /**
  37. * @param string $attrName
  38. * @return $this
  39. */
  40. public function setAttrName($attrName)
  41. {
  42. $this->attrName = $attrName;
  43. return $this;
  44. }
  45. /**
  46. * @return bool
  47. */
  48. public function isActive()
  49. {
  50. return $this->isActive;
  51. }
  52. /**
  53. * @param bool $isActive
  54. * @return $this
  55. */
  56. public function setIsActive($isActive)
  57. {
  58. $this->isActive = $isActive;
  59. return $this;
  60. }
  61. /**
  62. * @param null|string $name Name of the attribute
  63. * @return $this
  64. */
  65. public function setName($name = null)
  66. {
  67. $this->name = $name;
  68. return $this;
  69. }
  70. /**
  71. * @param string $key Key is used as index
  72. * @param string $value
  73. * @return void
  74. */
  75. public function setData(string $key, string $value)
  76. {
  77. $this->data[$key] = $value;
  78. }
  79. /**
  80. * @param array $data
  81. * @return void
  82. */
  83. public function addData(array $data)
  84. {
  85. $this->data = $data;
  86. }
  87. /**
  88. * @param TSampleInterface[] $list
  89. * @return void
  90. */
  91. public function addObjectList(array $list)
  92. {
  93. $this->data['objects'] = $list;
  94. }
  95. }