You are here

public function Counter::set in Purge 8.3

Overwrite the counter value.

Parameters

int|float $value: The new value.

Throws

\Drupal\purge\Plugin\Purge\Purger\Exception\BadBehaviorException Thrown when $value is not a integer, float or when it is negative.

\LogicException Thrown when the object got created without set permission.

Overrides CounterInterface::set

2 calls to Counter::set()
Counter::__construct in src/Counter/Counter.php
Construct a counter object.
RuntimeMeasurement::stop in src/Plugin/Purge/Purger/RuntimeMeasurement.php
Stop measuring execution time and store if necessary.

File

src/Counter/Counter.php, line 92

Class

Counter
Provides a numeric counter.

Namespace

Drupal\purge\Counter

Code

public function set($value) {
  if (!$this->permissionSet) {
    throw new \LogicException('No ::set() permission on this object.');
  }
  $this
    ->setDirectly($value);
}