Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TimerQueue.php

function TimerQueue::extract

Deletes and returns the callback on top of the heap if it has expired, otherwise null is returned.

Time complexity: O(log(n)).

Parameters

float $now Current event loop time.:

Return value

TimerCallback|null Expired callback at the top of the heap or null if the callback has not expired.

File

vendor/revolt/event-loop/src/EventLoop/Internal/TimerQueue.php, line 61

Class

TimerQueue
Uses a binary tree stored in an array to implement a heap.

Namespace

Revolt\EventLoop\Internal

Code

public function extract(float $now) : ?TimerCallback {
    if (!$this->callbacks) {
        return null;
    }
    $callback = $this->callbacks[0];
    if ($callback->expiration > $now) {
        return null;
    }
    $this->removeAndRebuild(0);
    return $callback;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal