classes/Models/Worker.php
public function currentInterval($format = null)
    {

        // Relative time formatting
        $abbreviated = [
            'pluraling' => false,
            'spacing' => false,
            'labels' => ['now', 's', 'm', 'h', 'd', 'm', 'y'],
        ];

        // Figure stuff out
        if ($this->isRunning()) {
            $interval = $this->WORKER_SLEEP_SECS;
        } else {
            $check = Cache::get($this->HEARTBEAT_CRON_KEY);
            if (empty($check)) {
                $interval = 'uncertain';
            } else {
                $interval = $check->interval;
            }
        }

        // Format it
        if (!is_numeric($interval)) {
            return $interval;
        }
        switch ($format) {
            case 'raw':
                return $interval;

            case 'abbreviated':
                return Library\Utils\Text::timeElapsed(time() - $interval, $abbreviated);

            default:
                return Library\Utils\Text::timeElapsed(time() - $interval);
        }
    }
public function currentInterval($format = null)
    {

        // Relative time formatting
        $abbreviated = [
            'pluraling' => false,
            'spacing' => false,
            'labels' => ['now', 's', 'm', 'h', 'd', 'm', 'y'],
        ];

        // Figure stuff out
        if ($this->isRunning()) {
            $interval = $this->WORKER_SLEEP_SECS;
        } else {
            $check = Cache::get($this->HEARTBEAT_CRON_KEY);
            if (empty($check)) {
                $interval = 'uncertain';
            } else {
                $interval = $check->interval;
            }
        }

        // Format it
        if (!is_numeric($interval)) {
            return $interval;
        }
        switch ($format) {
            case 'raw':
                return $interval;

            case 'abbreviated':
                return Library\Utils\Text::timeElapsed(time() - $interval, $abbreviated);

            default:
                return Library\Utils\Text::timeElapsed(time() - $interval);
        }
    }
public function currentInterval ( $ format = null ) { // Relative time formatting $ abbreviated = [ 'pluraling' => false , 'spacing' => false , 'labels' => [ 'now' , 's' , 'm' , 'h' , 'd' , 'm' , 'y' ] , ] ; // Figure stuff out if ( $ this -> isRunning ( ) ) { $ interval = $ this -> WORKER_SLEEP_SECS ; } else { $ check = Cache :: get ( $ this -> HEARTBEAT_CRON_KEY ) ; if ( empty ( $ check ) ) { $ interval = 'uncertain' ; } else { $ interval = $ check -> interval ; } } // Format it if ( ! is_numeric ( $ interval ) ) { return $ interval ; } switch ( $ format ) { case 'raw' : return $ interval ; case 'abbreviated' : return Library \ Utils \ Text :: timeElapsed ( time ( ) - $ interval , $ abbreviated ) ; default : return Library \ Utils \ Text :: timeElapsed ( time ( ) - $ interval ) ; } }
The current interval that heartbeats are running at
The current interval that heartbeats are running at