*/ private array $boundaries; /** * @param list $boundaries */ public function __construct(array $boundaries) { $this->storage = new BucketStorage(count($boundaries) + 1); $this->boundaries = $boundaries; } public function offer($index, $value, AttributesInterface $attributes, ContextInterface $context, int $timestamp): void { $boundariesCount = count($this->boundaries); for ($i = 0; $i < $boundariesCount && $this->boundaries[$i] < $value; $i++) { } $this->storage->store($i, $index, $value, $attributes, $context, $timestamp); } public function collect(array $dataPointAttributes): array { return $this->storage->collect($dataPointAttributes); } }