TermBucket.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. * Term Buckets
  10. */
  11. class TermBucket 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. * @param string $name
  27. * @param string $field
  28. * @param array $metrics
  29. * @codeCoverageIgnore
  30. */
  31. public function __construct($name, $field, array $metrics)
  32. {
  33. $this->name = $name;
  34. $this->field = $field;
  35. $this->metrics = $metrics;
  36. }
  37. /**
  38. * {@inheritdoc}
  39. */
  40. public function getType()
  41. {
  42. return BucketInterface::TYPE_TERM;
  43. }
  44. /**
  45. * {@inheritdoc}
  46. * @codeCoverageIgnore
  47. */
  48. public function getName()
  49. {
  50. return $this->name;
  51. }
  52. /**
  53. * {@inheritdoc}
  54. * @codeCoverageIgnore
  55. */
  56. public function getField()
  57. {
  58. return $this->field;
  59. }
  60. /**
  61. * {@inheritdoc}
  62. * @codeCoverageIgnore
  63. */
  64. public function getMetrics()
  65. {
  66. return $this->metrics;
  67. }
  68. }