You are here

protected function SanityCheck::store in MongoDB 8.2

Store a collection document count in its statistics bucket.

Parameters

int $value: The value to store.

1 call to SanityCheck::store()
SanityCheck::buildCollectionstats in modules/mongodb_watchdog/src/Install/SanityCheck.php
Build a list of the number of entries per collection in the default DB.

File

modules/mongodb_watchdog/src/Install/SanityCheck.php, line 113

Class

SanityCheck
Class SanityCheck provides some reasonableness checks for MongoDB contents.

Namespace

Drupal\mongodb_watchdog\Install

Code

protected function store(int $value) : void {
  if ($value <= 1 || $value >= $this->items - 1) {
    $this->buckets[$value]++;
    return;
  }
  $keys = array_slice(array_keys($this->buckets), 1, -1);
  foreach ($keys as $key) {
    if ($value < $key) {
      $this->buckets[$key]++;
      return;
    }
  }
}