RangeBucket.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Search\Request\Aggregation;
  7. use Magento\Framework\Search\Request\BucketInterface;
  8. /**
  9. * Range Buckets
  10. */
  11. class RangeBucket implements BucketInterface
  12. {
  13. /**
  14. * @var string
  15. */
  16. protected $name;
  17. /**
  18. * @var string
  19. */
  20. protected $field;
  21. /**
  22. * @var array
  23. */
  24. protected $metrics;
  25. /**
  26. * @var Range[]
  27. */
  28. protected $ranges;
  29. /**
  30. * @param string $name
  31. * @param string $field
  32. * @param array $metrics
  33. * @param Range[] $ranges
  34. */
  35. public function __construct($name, $field, array $metrics, array $ranges)
  36. {
  37. $this->name = $name;
  38. $this->field = $field;
  39. $this->metrics = $metrics;
  40. $this->ranges = $ranges;
  41. }
  42. /**
  43. * {@inheritdoc}
  44. */
  45. public function getType()
  46. {
  47. return BucketInterface::TYPE_RANGE;
  48. }
  49. /**
  50. * {@inheritdoc}
  51. * @codeCoverageIgnore
  52. */
  53. public function getName()
  54. {
  55. return $this->name;
  56. }
  57. /**
  58. * {@inheritdoc}
  59. * @codeCoverageIgnore
  60. */
  61. public function getField()
  62. {
  63. return $this->field;
  64. }
  65. /**
  66. * {@inheritdoc}
  67. * @codeCoverageIgnore
  68. */
  69. public function getMetrics()
  70. {
  71. return $this->metrics;
  72. }
  73. /**
  74. * Get Ranges
  75. *
  76. * @return Range[]
  77. * @codeCoverageIgnore
  78. */
  79. public function getRanges()
  80. {
  81. return $this->ranges;
  82. }
  83. }