Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Aggregation.php
Go to the documentation of this file.
1 <?php
7 
10 
16 class Aggregation implements AggregationInterface, \IteratorAggregate
17 {
23  protected $buckets;
24 
28  public function __construct(array $buckets)
29  {
30  $this->buckets = $buckets;
31  }
32 
38  public function getIterator()
39  {
40  return new \ArrayIterator($this->buckets);
41  }
42 
49  public function getBucket($bucketName)
50  {
51  return $this->buckets[$bucketName] ?? null;
52  }
53 
59  public function getBuckets()
60  {
61  return $this->buckets;
62  }
63 
69  public function getBucketNames()
70  {
71  return array_keys($this->buckets);
72  }
73 }