Item.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Reports\Model;
  7. /**
  8. * @api
  9. * @since 100.0.2
  10. */
  11. class Item extends \Magento\Framework\DataObject
  12. {
  13. /**
  14. * @var bool
  15. */
  16. protected $_isEmpty = false;
  17. /**
  18. * @var array
  19. */
  20. protected $_children = [];
  21. /**
  22. * Set is empty indicator
  23. * @codeCoverageIgnore
  24. *
  25. * @param bool $flag
  26. * @return $this
  27. */
  28. public function setIsEmpty($flag = true)
  29. {
  30. $this->_isEmpty = $flag;
  31. return $this;
  32. }
  33. /**
  34. * Get is empty indicator
  35. * @codeCoverageIgnore
  36. *
  37. * @return bool
  38. * @SuppressWarnings(PHPMD.BooleanGetMethodName)
  39. */
  40. public function getIsEmpty()
  41. {
  42. return $this->_isEmpty;
  43. }
  44. /**
  45. * @return void
  46. */
  47. public function hasIsEmpty()
  48. {
  49. }
  50. /**
  51. * Get children
  52. * @codeCoverageIgnore
  53. *
  54. * @return array
  55. */
  56. public function getChildren()
  57. {
  58. return $this->_children;
  59. }
  60. /**
  61. * Set children
  62. * @codeCoverageIgnore
  63. *
  64. * @param array $children
  65. * @return $this
  66. */
  67. public function setChildren($children)
  68. {
  69. $this->_children = $children;
  70. return $this;
  71. }
  72. /**
  73. * Indicator of whether or not children are present
  74. *
  75. * @return bool
  76. */
  77. public function hasChildren()
  78. {
  79. return count($this->_children) > 0 ? true : false;
  80. }
  81. /**
  82. * Add child to array of items
  83. *
  84. * @param array $child
  85. * @return $this
  86. */
  87. public function addChild($child)
  88. {
  89. $this->_children[] = $child;
  90. return $this;
  91. }
  92. }